Commit Graph

114 Commits

Author SHA1 Message Date
Dmitriy Rabotyagov 27078e06e8 Cleanup upgrade tasks
There were bunch of tasks for upgrading from lsyncd to the shared fs
mount, which can be safely cleaned-up now.

Change-Id: Ia0f5cbced196467007eafc61d3152ebea7559b84
2023-11-07 19:13:32 +00:00
Dmitriy Rabotyagov 6a2affb1a5 Ensure mounts are present only when they are expected to exist
At the moment there is a check, which ensures for race condition to
not happen between asking for a mount and mounting the point.
However, it tries to check for the mount when there is no mount
defined for the directory.

We add extra check to wait for the mount only when mounts are defined.

Change-Id: I900a55a6f4edce3d3fe419821c47cf56d641192f
2023-11-07 19:13:28 +00:00
Dmitriy Rabotyagov 8ae6540d0b Fix linters and metadata
With update of ansible-lint to version >=6.0.0 a lot of new
linters were added, that enabled by default. In order to comply
with linter rules we're applying changes to the role.

With that we also update metdata to reflect current state.

Change-Id: I74cefdfa885fa26dd7199fd0798527f511bf329d
2023-07-12 16:07:09 +02:00
Damian Dabrowski 2d0e465fd3 Add TLS support to repo_server backends
By overriding the variable `repo_backend_ssl: True` HTTPS will
be enabled, disabling HTTP support on the repo_server backend.

The ansible-role-pki is used to generate the required TLS
certificates if this functionality is enabled.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/879085
Change-Id: I5c5d3dd5689ac122781303ad21dacc8a1fa746eb
2023-04-28 11:27:09 +02:00
Kevin Carter f3fe518781 Convert include to include_tasks
Include is deprecated, additionally include_tasks is now faster.

Signed-off-by: Kevin Carter <kevin@cloudnull.com>
Change-Id: I20f92b972b794513cb774983f3aa6044769987d7
2022-09-03 21:14:29 -05:00
Jonathan Rosser a9ecec103d Restart nginx after removing old repo content
The version of nginx on centos-8 appears to keep file handles open,
possibly the old /var/www/repo directory persistently. Once the old
content is removed and the new shared filesystem mount is created at
the web root, ensure that nginx is restarted to close any file handles
which are now stale.

Change-Id: I941359b1b42aa4a874230a32b438dcefddfb2acb
2022-05-30 16:13:27 +01:00
Zuul 746c156311 Merge "Use distro packages for nginx on centos." 2022-05-30 09:17:45 +00:00
Jonathan Rosser e31bee556c Use distro packages for nginx on centos.
There is no longer any need to get these from EPEL or the
nginx repos.

Change-Id: I24a031b5e14359f08a231dfc3429468561d48126
2022-05-29 17:33:00 +00:00
Zuul ce74fc77b5 Merge "Avoid a race condition between mounting and using repo filesystem" 2022-05-27 19:24:27 +00:00
Zuul c9d33a7054 Merge "Clean up legacy lsycnd, rsync and ssh key config" 2022-05-27 17:32:45 +00:00
Zuul 8382f16001 Merge "Remove all code for lsync, rsync and ssh" 2022-05-27 13:57:54 +00:00
Jonathan Rosser 3b9a0f49a3 Avoid a race condition between mounting and using repo filesystem
Wait until the path is confirmed to be a mountpoint.

Change-Id: If220d073147d8f424cfe4f0d1ab494144b406860
2022-05-26 17:58:16 +00:00
Dmitriy Rabotyagov 703563c59c Run content restore only on first host
Currently we're trying to restore content for each host independently

This is not needed as we already storing content on shared FS,
that's been mounted.

We don't implement variable since that's only for migration purposes.

Change-Id: I0795fa1936aaeb9b9005a35685d85b6a4a619835
2022-05-25 13:58:02 +02:00
Dmitriy Rabotyagov a5df0d1a9b Have a symlink to u_c versioned file
With current behavior of u-c file that is stored on repo server and
migration to shared FS instead of lsyncd, we don't have any reliable
path to check for.

Also we have issue, that with updated u-c SHA users catch "unrelated"
error in python_venv_build role.

As a solution, we can create a symlink to the u-c file, that will have
persistant name and be updated with repo_server role run.

That would give us both file to verify and it can be used as u-c URI.

Change-Id: Ie7bdb9137ed69be465f014fa811b750dbec4e428
Related-Bug: #1943978
2022-05-20 06:56:39 +00:00
Jonathan Rosser 45d07fcf0c Clean up legacy lsycnd, rsync and ssh key config
These are no longer needed when a shared filesystem is used to
syncronise the repo server contents

Change-Id: I3109bd891d4c6b3522f5f741d9970093b1e882c8
2022-05-19 16:41:32 +00:00
Jonathan Rosser 03b55edaae Remove all code for lsync, rsync and ssh
Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/842571
Change-Id: I4f32c03179a1d8814548a92fc714a5fd9dd3f433
2022-05-19 16:33:18 +00:00
Jonathan Rosser 1f39aa0239 Add upgrade path from lsyncd to shared filesystem.
This patch checks if the repo server content directory is a mountpoint,
and if it is not, creates an archive of the repo server contents
before mounting the shared filesystem. After the mount completes, the
archive of repo server contents is copied to the shared filesystem.

This runs on every repo server in the deployment to include corner
cases of repo servers running different OS versions or CPU architecures
and will gather all of the content onto a single shared mount.

Change-Id: I976a5ea5f6b6ebd65c22e89657763fef87cf4b23
2022-05-16 15:29:59 +00:00
Jonathan Rosser c966363bd4 Add facility to store repo contents on a remote mount
Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/837706
Change-Id: I9008680a5f41287599d67f4ce70605b60bccabf3
2022-04-20 06:55:06 +00:00
Zuul 5aefc76d47 Merge "Use ssh_keypairs role to generate keys for repo sync" 2022-04-05 21:50:29 +00:00
Jonathan Rosser 8bdf307151 Use ssh_keypairs role to generate keys for repo sync
This uses ssh signed certificates so there is no longer the need
to distribute the repo_server public key from each repo_server to all
other repo_servers.

The legacy scripts and authorized key files are removed as a
migration step.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-plugins/+/836377
Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/825292
Change-Id: I27770f3a781bdf62d2a37659e087b12db2fb459e
2022-04-04 17:09:53 +00:00
Zuul 4f1f7b0387 Merge "Ensure insist=true is always set for lsyncd" 2022-02-10 15:31:13 +00:00
Jonathan Rosser ee0a6d5b37 Ensure insist=true is always set for lsyncd
If insist is not set to true then lsyncd will exit if it cannot
perform an initial rsync to the target hosts.

Due to the order in which the repo servers are configured, lsyncd
may be installed and started on the first host in the repo_servers
group before the ssh keys and other necessary configuration have
been placed on the remaining hosts. This leads to a failure to
start lsyncd.

This patch moves the setting of insist into the lua config file
for all operating systems, and removes the need to template a
defaults file on debian derivatives.

Change-Id: I26bb0e21d797c2bfbe67e03003da01c355c27561
2022-02-10 09:47:24 +00:00
Jonathan Rosser a91f79a43b Refactor use of include_vars
Use a first_found lookup instead of a with_first_found loop so that
the 'paths' parameter can be used.

This ensures that only vars from the role are included, and not vars
from a parent calling role. This can happen when a parent role has
a higher priority vars file available for inclusion than the role
it calls.

Change-Id: I14afe3040d8ecd8702edca19877ab50b6e57007f
2022-01-12 08:03:04 +00:00
Zuul 8f105a7c72 Merge "Allow constraints files to be hosted on the repo server" 2021-03-17 09:41:48 +00:00
Jonathan Rosser dfe91c5ac0 Remove references to unsupported operating systems
All references to Gentoo, SUSE, Debian stretch and Centos-7  are removed.
Conditional tasks, ternary operators and variables are simplified where possible
OS specific variables files are generalised where possible

Change-Id: Ibe914d0d547b930b8167bfa475cc838df8d7ae25
2021-03-16 08:51:12 +00:00
Jonathan Rosser aab7090e4d Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654

Change-Id: I3e48000a4685d4df46cd60113ce4c0c02b63dc0c
2021-02-23 09:24:07 +00:00
Jonathan Rosser 4400c9203f Allow constraints files to be hosted on the repo server
Change-Id: I2a28a180e0bb947da2b091ec0671a48ef857e8e5
2021-02-22 23:56:14 +00:00
Marc Gariepy 64c683aa13 Fix order for removing nginx file.
the default config needs to be removed after the pkg is installed.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-openstack_hosts/+/766030
Change-Id: Ibb9ccd8b85f673103f3ce863a8eb0641ebb056fb
2020-12-10 07:44:42 -05:00
Georgina 7132acbd3b Allow remote detection of repo sync status
If a repo container and its data are deleted and recreated then it is
not currently possible for a loadbalancer healthcheck to differentiate
between an empty repo server and a correctly synchronised one.

This patch creates a file 'repo-sync-complete' as part of the process
of synchronising repo contents from master repo servers to slaves. The
presence of this file on the slave can then be used as the loadbalancer
healthcheck to ensure that repo contents are only served once sync has
completed.

In addition, this patch ensures that synchronisation occurs from the
master to a reprovisioned slave by triggering a master repo server lsyncd
restart handler during the initial setup of the slave repo server.
Currently, a freshly provisioned repo server will remain empty
for an indeterminate amount of time, this patch forces a complete re-sync
to occur.

Change-Id: I6913341674dbde5524c2270e824bda4544211eca
2020-10-27 13:37:21 +02:00
Satish Patel 03b9cc3926 Add Centos-8 support
Reverting patch https://review.opendev.org/#/c/709532/ which is installing lsyncd using source
but now el8 epel repo providing distro rpm for lsyncd so we don't need to install from source.
also changing lsyncd.conf.lua path to /etc/lsyncd/ for centos8 support.

adding rsync-daemon rpm because centos8 islocated daemon and client in seperate package.

Change-Id: Ia8c1fad5728bd6adec510f8bc1d7bb754393de93
2020-08-24 23:59:47 -04:00
Dmitriy Rabotyagov fff1fc516d Do not install lsyncd when it's not needed
We don't need to build lsyncd when only 1 host is in repo_server group

Change-Id: I913531ce37af68d881c8968a966a94681a1abae9
2020-06-15 18:43:48 +03:00
Jonathan Rosser 486b68e3ec Restart rsyncd if the configuration file is changed
Previously the handler for restarting rsyncd was never called.
Split the config file template task out from the nginx task and
notify the rsyncd handler when the config file is changed.

Change-Id: I47982b5974c686a6dec7bd1a789daa54ea9652c7
2020-06-04 07:59:46 +01:00
Jonathan Rosser eea73c1011 Add Centos-8 support
This builds lsyncd from source files for CentOS 8 as there is no package
for it.

Change-Id: Iab8d28c32e534e62759dc2bc72bd6368fbea471d
2020-05-27 10:20:41 +00:00
Jonathan Rosser 0eb03be4bb Pass strings to git_config module rather than have implicit conversion
This avoids the following warning:

[WARNING]: The value 0 (type int) in a string field was converted to u'0' (type
If this does not look like what you expect, quote the entire value to
ensure it does not change.

Change-Id: Ifaf4035b2101f6921182c3d3275554c7e5f4cfa2
2020-05-12 14:12:53 +01:00
Jonathan Rosser cf53ebacbd Remove apt-cacher-ng cleanup tasks
The apt-cache was removed a long time ago and these tasks should
already have been removed in the Train release. Remove them now.
There is no change for existing deployments as these tasks are no
longer required as the apt-cache component of the repo server is already
retired.

Change-Id: I42785ee153955eb6e72bef01c26791ae8eec2087
2020-05-02 18:48:59 +00:00
Dmitriy Rabotyagov 748d86411b Remove git deamon functionality
Caching git repositories has been deprecated in Queens, so it's high time
we removed this functionality.
This shouldn't influece OSA deployments in any way.

Change-Id: I35829aa35489f06dbb3b65f522f0a08318eccbfa
2020-05-02 16:53:16 +01:00
Kourosh Vivan bd8a24716c Add possibility to overwrite nginx public repo
For Centos, we use by default public repo for nginx. You can change this
behaviour with these role-wide variables:
- repo_centos_nginx_mirror
- repo_centos_nginx_key

Or with these osa-wide variables:
- centos_nginx_mirror
- centos_nginx_key

Change-Id: I8dcb3c97e9593877a4a420bd32b50ae29d9d311c
2019-11-05 10:11:11 +01:00
Kourosh Vivan aecff065f1 Add Centos GPG key custom url
When using a custom repo with repo_centos_epel_mirror, you maybe need to
change the gpg key url because offline env

You can use this variable: repo_centos_epel_key

Change-Id: I9bb305d866f3d65653b95a25a5b9f5ecde5af0b0
2019-10-17 20:56:01 +02:00
Mohammed Naser ba7b358ccd [redhat] Install rsync-daemon for newer releases
The newer packages havee moved rsyncd into its own package called
rsync-daemon so we'll install that for anything newer than EL7.

Change-Id: Id1e8cc503d71cf6e7d0d84b5a74f6c3d7bce9393
2019-05-10 12:56:22 -04:00
Mohammed Naser 44547c7b7b pypiserver: drop pypi server
It is no longer needed because of how we are using python_venv_build
at the moment, so let's remove it.

Depends-On: https://review.openstack.org/648477
Change-Id: I56531388fb49a8c3d098fd762392299742b0e120
2019-03-29 10:02:36 +00:00
Jonathan Rosser a68a384a4f Enable git automatic thread count detection
The repo build process does many git clone operations. This patch
ensures that the repo server git configuration allows git to detect
and make use of the number of CPU which are present, which
benefits operations such as check out which are highly threaded.

Change-Id: Ib01fc1c560dcb9261c328841d7472c87434edab0
2018-11-22 14:00:43 +00:00
Jonathan Rosser 467f8e3080 Use distro packages only after they are installed
In an environment with sudo and lsyncd not already installed the pre
install tasks try to set up config files before the config directories
exist, and the tasks fail.

This patch moves the sudo and lsyncd config tasks to run after the
distro packages have been installed.

In addition, sudo is added as a required distro package for the
repo server.

Change-Id: Iab09b732d63d007c1d638ec9dc35834e564e5ce5
2018-10-25 12:08:26 +00:00
Jesse Pretorius 6663637374 Remove apt-cacher-ng
The repo container's package cache causes quite a bit of confusion
given that it's a 'hidden' feature which catches deployers off-guard
when they already have their own cache configured. This is really
the kind of service which people should manage outside of OSA. It
also makes no sense if the deployer is using their own local mirror
which is a fairly common practise. Adding to that, it seems that it
is broken in bionic, causing massive delays in package installs.
Finally, it also adds to quite a bit of complexity due to the fact
that it's in a container - so in the playbooks prior to the container's
existence we have to detect whether it's there and add/remove the config
accordingly.

Let's just remove it and let deployers managing their own caching
infrastructure if they want it.

Change-Id: I829b9cfa16fbd1f9f4d33b5943f1e46623e1b157
2018-10-08 14:48:32 +01:00
Kevin Carter 45bb9631b1
Add variable for the ssh service
The ssh service on ubuntu based systems is "ssh" which is established by
the service unit path `/lib/systemd/system/ssh.service`. When running
the service will respond to the name "sshd" however this is just an
alias. This change adds a variable to set the service unit name
based on the distro family which will allow the service to start should
it be masked.

Change-Id: I04b9f5ed761270c0bb76b607a6562b511c6f4773
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-09-30 10:00:05 -05:00
Jesse Pretorius 73941167f1 Ensure that SSHD is installed, enabled and running
The repo server relies on SSHD for the repo synchronisation,
so in this patch we ensure that it is installed, enabled and
running.

Change-Id: I0618e76125fc1489903b3518b9bef3999c8c7347
2018-09-14 14:40:15 -06:00
Jesse Pretorius 46ae829b33 Create virtualenv with '--never-download'
For upgrades, and some new build configurations, trying to
create a new venv results in the error:

Could not get output from /usr/bin/virtualenv --help: Traceback (most recent call last):
File "/usr/bin/virtualenv", line 6, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

To work around this issue, we do the initial build of the
venv using the CLI with the argument '--never-download'
so that virtualenv just uses the versions of pip, setuptools
and wheel that it already has.

Change-Id: I639bc78d34b640a52c32fa175b12fa958518e999
2018-08-09 08:54:24 +01:00
Jesse Pretorius 968ea1f223 Remove repo_requires_pip_packages and pip_install meta-dep
Given that the openstack_hosts role installs pip and virtualenv,
we do not need this extra meta-dependency and extra task/var.

Change-Id: Iac9f72586f6b26bd31d59a4fa5055687ff77f78b
2018-07-31 18:16:53 +00:00
zhulingjie 7c8e10977d Remove the unnecessary space
Change-Id: I4edb409131d122b2e426d115ee94c4a986bd3606
2018-07-11 23:02:53 -04:00
Jean-Philippe Evrard 6802793bb9 Fix usage of "|" for tests
With the more recent versions of ansible, we should now use
"is" instead of the "|" sign for the tests.

This should fix it.

Change-Id: Ib73373d8801c9eedd7c6e92b994a2fba0349ed90
2018-07-12 17:01:52 +02:00
Mohammed Naser 695503aa24 Add upstream NGINX and EPEL for selected packages only.
With the removal of EPEL, we are selectively adding packages that
we need.  This patch adds EPEL repositories only for lsyncd to
avoid conflicts and the NGINX upstream repositories for the web
server.

Change-Id: I832ae27570c5f35d01728a9e387fc451447b38ce
2018-06-16 23:27:55 -04:00