Commit Graph

70 Commits

Author SHA1 Message Date
Dmitriy Rabotyagov d3ef8b1256 Deprecate openstack-ansible-galera_client role
Since we moved all functionality of galera-client part to galera-server
role there's no sense in futher keeping and branching of client part.

Depends-On: https://review.opendev.org/c/openstack/project-config/+/765777
Change-Id: I1623dbc80bee4eb7d889ee570d0ce27697b58cea
2020-12-07 12:41:44 +02:00
ShangXiao 3e1ab8c307 Fix a type in yml file
Change-Id: Ia0c26a5c45f8f3ec4fce7459872da9d54fe8985e
2019-11-19 16:49:47 +08:00
Zuul 6277f90074 Merge "add gentoo support to galera_client" 2019-02-26 14:18:50 +00:00
Matthew Thode b248d73899
add gentoo support to galera_client
Change-Id: I1506c5df2653b18a7d6e3294efb2e8bca857711c
2019-01-27 00:16:24 -06:00
Zuul 0906a82944 Merge "Revert "cleanup: don't update_cache when adding a new repo"" 2019-01-07 15:16:32 +00:00
Jesse Pretorius (odyssey4me) e31b259cb5 Revert "cleanup: don't update_cache when adding a new repo"
This reverts commit d8e1f4d83c
because the tasks are implemented that way for the following reason.

If apt_repository fails to update the apt cache after updating the
configuration, retries don't register there was a change and so no
attempt is made to update the cache by the module on the second attempt.
This failure can result in a failure to install packages.

This change adds an apt module task to update the cache if the
apt_repository task registers a change. This means updating the cache
will get retried on failure and no longer fail silently.

This was all explained in the commit message for
I41de2b9a98977bb89de812a9fbc85a9f99d62942 but no notes were
added to the tasks, resulting in the confusion. To prevent this happening
again, we add the comments from Id059dbec3466cb1ef3ea567249f52384a8ade515
into these tasks.

Change-Id: I110f6fa3b6c6341ec4a8bd8cf69ae61bbbb50689
2019-01-07 11:30:22 +00:00
Mohammed Naser bca87952a8 cleanup: stop setting priority in a follow-up task
We can set priority directly inside the yum_repository module
therefore there's no need for us to actually set it in a follow-up
task that's not idempotent.

Change-Id: Ie5ae5c051055ed532b3ae9dd64c2cb3d15c7173a
2018-12-29 17:56:58 -05:00
Mohammed Naser d8e1f4d83c cleanup: don't update_cache when adding a new repo
We don't need to update_cache when we add a new repo because
we already do it when we install the package in the follow up task.

Change-Id: I1c32655eddee6c37d7433e6aca8be851344e93e4
2018-12-29 17:49:09 -05:00
Mohammed Naser f2baa61923 cleanup: remove tasks from pike
These tasks were to be removed from Pike which take care of cleaning
up old resources.  They are no longer necessary.

Change-Id: I1e4b4c333b1f420c7deb2756ac4433361b5aeea4
2018-12-29 17:45:27 -05:00
Mohammed Naser 30cb1e72d6 cleanup: stop managing files inside /etc
If we're installing a client, there's absolutely no need for us
to be touching things inside /etc.  This is not being done inside
the process installing on Debian based operating systems however
it is being done under CentOS and SUSE.

Change-Id: I49790baa8394d9d6d412bf06252e9812f766ea30
2018-12-29 17:44:22 -05:00
Jesse Pretorius 6c7aee86f5 Use in-repo GPG keys
We make remote network hits to get the GPG keys which are quite
unreliable, and apt_key does not support using a proxy properly [1]
so let's store them inside the role and use them.

The implementation here is derived from that which was done in the
galera_server role in I9443f10e8c803599cbebfc2a53cb9c432bfa60d1,
but opts to use a mechanism that will be simpler to maintain.

[1] https://github.com/ansible/ansible/issues/31691
Change-Id: I520ccbadf3320b0d07fc83e3dbec9ea2bd16ec83
2018-12-14 19:36:40 +00:00
Jesse Pretorius d1d4bf4ac7 Find the list of packages to remove using rpm
In https://review.openstack.org/603056 we tried to remove conflicting
packages from the target host before installing packages from MariaDB,
but that didn't work because the package specified didn't exist. The
name used was an attempt to remove a specific version of the package
to avoid yum always removing and reinstalling the same packages.

Unfortunately yum is case-insensitive, and CentOS/EPEL/RDO have
mariadb-* packages, while the MariaDB repo has MariaDB-* packages.
These packages conflict.

To work around yum's case insensitivity, we have to query for any
installed packages using rpm (which is case-sensitive) and remove them.

We have to remove them without dependencies, otherwise for distro
package installation types on shared hosts it removes far too many
packages.

Change-Id: Ide19d3c1b8b0f1e6aed2ea01f2f082e6a2cbb83a
2018-09-18 03:43:30 +01:00
Markos Chandras e74cdc2911 RedHat: Remove packages with conflict with MariaDB
Fixes the following problem since the upgrade to MariaDB 10.2

 file /usr/lib64/mysql/plugin/mysql_clear_password.so from install of MariaDB-common-10.2.17-1.el7.centos.x86_64 conflicts with file from package mariadb-common-3:10.1.20-2.el7.x86_64

Change-Id: I686ff5d70548f15a60f623e30b0b37fb0d525b8b
2018-09-17 11:36:10 +01:00
Jonathan Rosser f33286d603 Add retries for apt https transport installation
Change-Id: I75a3e9b95e6f13066caed2a902da8b7d7f7abd40
2018-08-06 12:09:23 +01:00
Jean-Philippe Evrard 80acadbb1e 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: I0c304714a3891b266489e65634669ef1d332a2f7
2018-07-18 02:42:57 +00:00
Jean-Philippe Evrard fea1b6bc64 Add Bionic testing
Now that bionic testing is added into the tests repos, we can
start testing it in the repo.

The /etc/apt/sources.list.d/ is not created in all the bionic
images, so we ensure it is created before using it.

Depends-On: https://review.openstack.org/#/c/566959/
Change-Id: I05c1bc8a0413dbb88514905b6fdf33304829484f
2018-05-14 20:51:59 +02:00
Markos Chandras e6f4ae3c06 Drop pointless PIP packages
Nothing in the role requires the MySQL-python package so we can simply
drop it to simplify the role.

Implements: blueprint openstack-distribution-packages
Change-Id: Id9dd2dea146709414ab9ce8d439f1587e6776fd4
2018-04-18 14:24:10 +01:00
git-harry 69729be3d1 Fix cache update after initial apt_repository fail
If apt_repository fails to update the apt cache after updating the
configuration, retries don't register there was a change and so no
attempt is made to update the cache by the module on the second attempt.
This failure can result in a failure to install packages.

This change adds an apt module task to update the cache if the
apt_repository task registers a change. This means updating the cache
will get retried on failure and no longer fail silently.

Change-Id: I41de2b9a98977bb89de812a9fbc85a9f99d62942
Partial-bug: 1750656
2018-02-21 10:39:34 +00:00
Major Hayden 29e195871f
Change include: to include_tasks:
Change-Id: I5ca6ee73926845bc6d2e92b4a858ba3ae8511e5d
2018-02-15 10:26:28 -06:00
Markos Chandras 934344ab41 Set proper yum repo priority on CentOS 7
This patch ensures that we get galera from the MariaDB repos
and not from RDO. This matches I2c8e4e64c2425cd36903ae9288bd9fee29eef355
which did the same thing for the galera-server role.

Closes-Bug: #1739472
Change-Id: I8f22083a306ba7569148a53af94397c31d90dbac
2018-02-09 10:14:54 +00:00
Mohammed Naser a726ae1ff9 Revert "RedHat: Ensure that conflicting MariaDB packages are removed"
This patch uninstalls the MySQL server from the system when
it shouldn't be messing about with it as the role manages the
client.

This reverts commit 72cc31a4d6.

Change-Id: Ief5cf57e23dfbf9a05aa9051d0ec46d85ac19bbf
2018-02-08 21:57:32 +00:00
Markos Chandras 72cc31a4d6 RedHat: Ensure that conflicting MariaDB packages are removed
When the galera_client role is deployed along with other roles, some
of them may pull mariadb packages as a dependency for the services
they deploy. However, this role uses MariaDB packages from the upstream
repository which conflict with those provided by the EPEL or the RDO
ones so we need to ensure that they are gone before we install the
upstream ones.

Closes-Bug: #1739472
Change-Id: Ie1a2126986ee95671ece79374e1385846c8cce1a
2018-02-07 12:01:17 +00:00
Markos Chandras bb6feac7ab SUSE: Switch to upstream MariaDB repository
The OBS development repository was proven to be quite fragile since
the mariadb packages were moving far to quickly. Whilst this has helped
to catch bugs when OpenStack services were used against newer MariaDB
versions, it also created a very unstable infrastructure for openSUSE
deployments. As such, we have now switched to using the upstream SLE
packages as provided by MariaDB upstream so all distributions are
aligned to how they deploy the Galera clusters. This further allow us
to report upstream bugs which fix problems across all distributions.

Galera server Role fix: https://review.openstack.org/#/c/536955/
Change-Id: Ib270b0fe23de76620491247efc3352fbc6c1e9b5
2018-01-24 15:22:35 +00:00
Jimmy McCrory 5d2988c938 Fix SSL cert distribution tasks
The 'galera_cluster_members' variable has been added, matching the
default value from the galera_server role and used by the
'galera_ssl_ca_cert' variable to find a galera node within the inventory
to attempt to pull cert files from.

Since the slurp task that checks for an existing CA cert file is set to
never fail, the debug message should check if any content was found. The
changed_when can also be removed since slurp tasks only return 'ok'
when a file is found.

The task copying an existing cert from a server was using a 'src'
argument where it should be 'dest'.

Change-Id: I95cc994df5118fce7ce588fc0bff979bc283a6f3
2017-12-13 15:10:51 -08:00
Kevin Carter e5634d99fd Fix SSL handling for galera clusters
The SSL handler was making an assumption a user provided SSL key will
always be available. This change forces this role to look for the SSL
CA key on a galera server and set it locally IF a user provided SSL ca
certificate is not provided.

To ensure we're not introducing regressions a cross project repo test
has been added to run installations that are with and without ssl.

Depends-on: I5f6465f0d955cc1b911a4a76482505edb16c69a8
Change-Id: Ib89dde5cc88182f81d81336f71d9cde89733aa65
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2017-11-30 18:50:29 +00:00
Jesse Pretorius 68ab663a6e Use block/rescue for error handling
Instead of allowing the first task to fail, then
using the fallback - use block/rescue to achieve
the same, but totally skip the second task if the
first succeeds.

Change-Id: Ic90ffdc7dabc1477050f66a23f8bd7cc85682b07
2017-08-11 09:08:56 +01:00
Jesse Pretorius 5bf760a412 Allow MariaDB repo overrides without extra-vars
It may be required to override the repo information
in its entirety, rather than just the URL. This
patch allows that to be done.

Change-Id: Ic7e77f0a442a82a424e75a9d79c9c6116818cfc1
2017-08-08 17:54:48 +01:00
Major Hayden bc11789e18
Add dnf support
This patch adds dnf support on CentOS.

Implements: blueprint centos-and-dnf
Change-Id: I074d0fe8e03807e173787ac10340a332d856345c
2017-08-02 13:13:38 -05:00
Markos Chandras 5d04a669b9 tasks: galera_client_install_zypper: Drop zypper workaround for Ansible < 2.2
openstack-ansible is using Ansible >= 2.3 so we can safely drop the <2.2
workaround for zypper and import the repository keys directly using the
auto_import_keys option.

Change-Id: Ic839829df9f96b3145f8a5d7c77f0f7b04fba12e
2017-07-11 18:07:02 +01:00
Major Hayden fba14dd205
Cleanup Galera client role
This patch does a few cleanups:

  * Removes jinja2 content from when
  * Switches to package module to install pkgs
  * Pass package lists as a list (not with_items)

Change-Id: I50e7029053fb21cedcee6a8e122f0442f1d587ff
2017-05-19 13:30:59 -05:00
Andrey c093c13e01 Added Galera SSL support
MySQL SSL connections allowed. Self-signed SSL CA cert or user-provided
CA certificate delivered from the deployment host.

Change-Id: Iaa07435357139133e325d85808b419e8c55b5e50
Partial-Bug: #1667789
2017-03-31 08:43:13 +00:00
Markos Chandras 1a4c83af1c SUSE: Use MariaDB package from the OBS repository
Use the Open Build Service server:database repository to get the
MariaDB package which contains proper galera support for openSUSE
Leap. This also renames the vars/suse.yml file to suse-42 in order
to support just the openSUSE Leap distributions which are more stable
than Tumbleweed.

Change-Id: I77fbc7447ac3908b904b0313b11dc1d5f82b5376
2017-03-10 12:54:28 +00:00
Markos Chandras 07bc2ba504 Add SUSE support
Add new variables and tasks files for SUSE based distributions. The
required packages are present in the default repositories so no
additional repository configuration is necessary.

Change-Id: Idd7cc55baabf7e2da0807cedd3a37a7d887f3219
2017-02-20 21:53:50 +00:00
Major Hayden 1bfb4553ad
Use dynamic includes to save time
This patch adds a dynamic include for installing packages
via yum or apt. It avoids having so many skipped tasks and
should save some time during gate runs.

Change-Id: I953764b7bb95df0625993a31ba4effc8b81499aa
2017-02-20 13:20:41 -05:00
Jimmy McCrory 22b7d9c761 Replace grep and which commands with find module
For improved idempotence within the role, replace the use of `grep` and
`which` through the 'command' module with the 'find' module.
changed_when and failed_when statements around these tasks can be
removed.

Partial-Bug: 1640134
Partial-Bug: 1640144
Change-Id: Iebbcd52f673dba657117ac21ef1fa809bf344521
2017-02-14 11:07:27 -08:00
Jean-Philippe Evrard b2ff928a70 Remove old repos with different filenames
If the deployer used another name for the MariaDB repo, the old repos
in this file wouldn't get cleaned.

Change-Id: I27ab79cd9a29b42a5a98357a2e9b49cee7dcc618
Signed-off-by: Jean-Philippe Evrard <jean-philippe.evrard@rackspace.co.uk>
2017-01-09 16:05:26 +00:00
Jean-Philippe Evrard c3373b4641 Bring consistency to tags
If we filtered this role by running only on tags config/install,
the task(s) changed here wouldn't be properly targeted.

Change-Id: I4148c09733ada1f40da18b8cabc8e69d75686b06
2017-01-05 11:09:53 +00:00
Jean-Philippe Evrard 8935c29e70 Allow override of the repo filename
Apt cannot have 2 mirrors with the same content in 2 different files.
If a deployer has an apt mirror with mariadb (and others), the deployer
still need to add a repository, but will also need to define the
filename used, in order to avoid clashes.

This commit makes possible to decide the filename for the repo.

Change-Id: Ic83d464512f6f8697e520d79520dcf21370f8beb
Signed-off-by: Jean-Philippe Evrard <jean-philippe.evrard@rackspace.co.uk>
2017-01-03 13:38:47 +00:00
Jenkins c73ede46c4 Merge "Allow jinja conditionals in package install tasks" 2016-11-29 17:10:17 +00:00
Andy McCrae c13983adce Allow galera_client role to skip package installs
This patch adds the galera_client_package_install option which allows
the deployer to skip the installation of the galera_client packages, and
simply set up the /root/.my.cnf configuration file.

This is useful for deploying the client on hosts that already have
galera client configured, but still want the client configuration setup.
For example the galera_server role which can have a conflict when the
client and server repository version don't match.

Change-Id: I00d662a8afc7ddd4778787d31dc394a0ea3b1401
2016-11-28 20:11:13 +00:00
Jimmy McCrory 6743229aa5 Install MariaDB 10.1 client
Update repos and packages to install the client for MariaDB 10.1, the
current stable release.

Make use of the yum_repository module for installing on yum based
systems and give the apt repository file a consistent name, 'MariaDB',
for easier maintenance and handling of upgrades going forward.

Change-Id: I8939703f26e5d8adc393b984266f4cad7a6e0b4c
2016-11-24 09:57:35 -08:00
Logan V 4d0d568505 Allow jinja conditionals in package install tasks
When a jinja conditional like this is used to override the package
list:
galera_client_distro_packages:
  - mariadb-client
  - "{{ 'libmariadbclient-dev' if 'repo_all' in group_names else None }}"

Note: I also tried '' instead of None

The task fails because it cannot install a package named ''. It does
not skip the empty string. This makes it impossible to conditionally
install a package with the OSA tasks, because the override cannot be
done using group_vars due to Ansible's variable precedence prioritizing
role vars above group vars.

This change simply allows the package install task to skip empty strings,
enabling the above override.

If this pattern is accepted I intend to implement it across all of OSA's
package install tasks.

Change-Id: Ib88458d7de3f1ef4e14921b01966a79d3919fd9d
2016-11-20 11:30:12 -06:00
Jesse Pretorius a7c775302e Remove join filter from pip module tasks
Ansible 2.2 now treats the 'name' argument for the pip module
as a list, removing the need for us to implement the join
filter to optimise the install execution.

Change-Id: I03baaa16662072a78f0d506c6d2b8e9c62f205f8
2016-11-09 21:30:40 +00:00
Jean-Philippe Evrard f3cebd1f1d Use apt_repository update_cache feature
With ansible 2.2, apt_repository update_cache feature has
been fixed. When a new repo will be added, apt-get update
will be run after the addition if update_cache is set to yes.

This combined with the apt module now properly checking the
cache validity, we can now have proper updating of the cache
with registering variables.

Change-Id: Icb10352ef319bfbc80151708393e81e7533a1f13
2016-11-04 16:50:58 +00:00
Jean-Philippe Evrard c0a1550cbe Remove ansible<2.2 apt cache hack
Now ansible apt module correctly behaves, so it's time
to deprecate these cruft tasks for apt.

Change-Id: Ifd1ae9b7f05c49efbc469ef731187a9eadd3fcdb
2016-11-03 23:30:27 +00:00
Jesse Pretorius 25f472cec3 Ensure upper constraints are respected
With the current python package installation, packages
are installed with no regard to upper constraints. This
can result in an inconsistent set of packages being
installed when re-executing the role.

This patch ensures that if upper constraints are defined
then they are respected.

Change-Id: Id1e7e8f74f513c022e7f06942c65da94ad7df9d8
2016-11-02 13:39:10 +00:00
Logan V 10d789e9be Fix linting issues for ansible-lint 3.4.1
Preparing this role for the ansible-lint version bump

Change-Id: I9f4ca928cd19b7e73b1727734551ea61d676e49c
2016-11-02 01:58:54 +00:00
Jenkins 639a563fa2 Merge "Do not ignore_errors for fallback keyserver" 2016-10-17 17:57:54 +00:00
Kevin Carter 9dc6e60247 Remove 'ignore_errors: true' in favor of 'failed_when: false'
This change removes the use of 'ignore_errors: true' because it causes deployers
to see red output and a stacktrace, which traditionally means something is broken,
even when the failure is known to have a fall back option or be intentional. This
conversion will provide a generally cleaner interface.

It should be noted that the 'failed' filter will still function normally. Tasks
with the 'failed_when: false' option will still be marked as 'failed' in any
registered variable. This change simply makes the output look cleaner.

Change-Id: I2c1b39905720e8e6ecb51d88f36c9eb47329d328
Closes-Bug: #1633438
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-10-16 15:00:13 +00:00
Jesse Pretorius 1acef89dc0 Do not ignore_errors for fallback keyserver
The initial keyserver usage should ignore errors so that
the fallback keyserver can be used. However the second
task should not ignore errors as there is no third
keyserver - if the first has failed, and the fallback has
failed, then the task should fail and the installation
should stop.

Change-Id: I6869ca71d81ab6cb39c328925583c9a9d81844bb
2016-10-16 14:36:34 +01:00