76 Commits

Author SHA1 Message Date
Miguel Alex Cantu
34f52a673e Add ignore_none_type to config_template
The .cnf files can have valueless options present.
This commit ensures that these valueless options are not ignored

Addtionally, my.cnf overrides are added to the variable overrides
test file to ensure that the my.cnf file can run through the
config_template engine properly.

Change-Id: I8b09c2520c84bb43353b4c56bac157259f71b041
Closes-Bug: #1693234
2017-06-27 16:19:23 +00:00
Markos Chandras
34d3b00255 Add support for the openSUSE Leap distributions
Add support for the openSUSE Leap distributions. For openSUSE we use the
packages provided by the Open Build Service repository which contains the
Galera clustering support. These packages are different compared to the
CentOS7 and Ubuntu ones so the way the cluster is being bootstrapped is
also different. The systemd service file can't be used for that, so we
need to modify the MariaDB configuration file on the boostrap node to
initiate the cluster. Moreover, files are installed in different places
so we need to modify the distribution files and templates to take that
into consideration as well.

Change-Id: I1ac31fbc06152da7f93e57911d4a952f0dd83849
2017-06-19 20:57:29 +01:00
Jenkins
51f5adc70b Merge "tasks: Set Restart option for systemd service file" 2017-06-19 14:20:01 +00:00
Jenkins
121b7af3a9 Merge "tasks: galera_upgrade_post: Retry if starting the MariaDB service failed" 2017-06-19 14:16:11 +00:00
Jenkins
c8396722aa Merge "vars: main: Split percona packages from the galera server ones." 2017-06-19 14:16:05 +00:00
Marc Gariepy
588b9cead7 Move PrivateDevices before mysql password set
Move the PrivateDevices before we try to start the service the first time

Related-Bug: 1697531
Change-Id: I67ef7ba02ee652e9855b9cf4ba7a44a361844a83
2017-06-16 10:49:47 -04:00
Jimmy McCrory
bc963815ca Dynamically include upgrade_check task files
Dynamically include the correct galera_upgrade_check task file based on
the ansible_pkg_mgr variable.

Change-Id: Icf7a2556fc303f8920a85873a6f44d4548b7f459
2017-06-14 15:33:05 +00:00
Markos Chandras
bea68f18cc tasks: Set Restart option for systemd service file
In order to have a consistent systemd behavior across distributions, we
define the Restart condition for the galera service file. The 'on-abort'
option is currently the default in the upstream service file and it's
also the most conservative one so we chose that to be the default option
in the Ansible role as well. We also set a reasonably low RestartSec
value as well.

Change-Id: If442802f7aff4473cbb573ba1c123cfc46bde9b3
2017-06-14 15:32:22 +00:00
Markos Chandras
531bf8ed2a tasks: galera_upgrade_post: Retry if starting the MariaDB service failed
Similar to the galera_running_check play, we should retry a few more
times if the MariaDB service failed to start.

Change-Id: Ie07468a065af0668db1da1d52b81af3fcee53dca
2017-06-14 15:32:01 +00:00
Markos Chandras
22a87ddf74 vars: main: Split percona packages from the galera server ones.
The role uses the 'use_percona_upstream' variable to determine if
specific external packages are going to be used instead of the distro or
upstream ones. The {qpress,percona}_package_path variables only make sense
if we are going to use such external packages so we convert their static
declaration into a 'set_fact' task. This also allows distributions to
override the default package list with an empty list if they do not plan
to use local percona packages.

Change-Id: Icb65f6c8c1654e24f73e1e5310516cd9b3568aad
2017-06-14 15:31:43 +00:00
Major Hayden
f46e152506
Disable PrivateDevices for Galera on CentOS 7
This patch adds the `galera_disable_privatedevices` variable that
allows deployers to disable PrivateDevices in the systemd unit file
shipped with MariaDB 10.1+ on CentOS 7 systems.

This is a workaround to fix the systemd/LXC issues with bind
mounting an already bind mounted `/dev/ptmx` inside the LXC
container.

See Launchpad bug, lxc/lxc#1623, or systemd/systemd#6121 for more
details.

Co-Authored-By: Major Hayden <major@mhtx.net>
Closes-bug: 1697531
Change-Id: I8a74113bd16a768a4754fb1f6ee04caf1ac82920
2017-06-14 09:02:08 -05:00
Logan V
963d7a06ed Add fallback fetch for xtrabackup and qpress
Change-Id: I87313ded52b2c1046782b45e90f2a73e5b8dcc90
2017-04-26 00:37:44 +00:00
Jirayut Nimsaeng
61609d8f9f Fix conditional check error when run galera-bootstrap tag
Task "Start mysql node normally" needs to add "galera-bootstrap"
tag or it will causing conditional check error on mysql_started
variable

Change-Id: Id7e3fd30480b39b200cffb085c212b5ab5229f04
Closes-Bug: #1680694
2017-04-07 12:17:42 +07:00
Jenkins
fd0a6b104a Merge "Added Galera SSL support" 2017-03-30 22:11:43 +00:00
Andrey
eb5fc9c1e8 Added Galera SSL support
MySQL SSL connections allowed. Self-signed SSL bundle
created and placed to the deployment host, or user-provided
SSL bundle (CA, cert and the key) is used.

Change-Id: Ibac61d45cea67123fe61a6de4f906b4bd1949a34
Partial-Bug: #1667789
2017-03-30 09:42:38 -05:00
Andy McCrae
db64210b12 Fix upgrades for multinode galera
During an upgrade, we run the upgrade in serial, and we attempt to
bootstrap the cluster from the "galera_server_bootstrap_node". This
causes issues when there is an existing cluster that is still up.

To avoid this, we can simply attempt to start the cluster normally, if
it fails to start, and join the existing cluster,  we can bootstrap as
usual.

Additionally, we can make the bootstrap slightly more efficient by only
running it against the bootstrap host and splitting out the
"galera_upgrade_post.yml" tasks.

Finally - run the upgrade in serial which mirrors our approach in the
integrated repo.

Change-Id: Ic4d69f0fa75c1eea81d10a76cca9a8d9c3822094
Closes-Bug: #1667103
2017-03-22 14:31:28 +00:00
Jenkins
6bcf1e2383 Merge "Upgrade: Make removal list distribution-specific" 2017-03-16 12:31:39 +00:00
Jesse Pretorius
f939bf150f Upgrade: Make removal list distribution-specific
When trying to execute an upgrade the removal fails
if packages in the list are included that cannot be
found in one of the repositories configured.

This patch endeavours to only remove packages that
will be found.

Change-Id: I67cc225b25fca005cdba3bf67793b4f23d6ae82a
2017-03-16 11:05:23 +00:00
Jesse Pretorius
03b702b26a Rename vars/common.yml to vars/main.yml
The file vars/main.yml is automatically loaded
so by using this file name we're able to get
rid of the task that loads vars/common.yml which
is a small optimisation.

Change-Id: I4e32c8e10414080a5c0bd14df874a28b8f28e9fa
2017-03-14 16:11:17 +00:00
Jesse Pretorius
1da7340a99 Force clean yum metadata when repo config changes
When changing the repo URL, the metadata does not reliably
update, resulting in the right URL being used, but the
wrong package list. This is why we force the metadata to be
cleaned out whenever the repo config changes.

Change-Id: I9bca9a89b58cd539dd5c224d6b141dc4d844bcc2
2017-03-14 15:25:43 +00:00
Jimmy McCrory
2f68deee89 Fix fact set using ternary filter
When the set_fact module is used with the ternary filter the evaluated
condition must be surrounded in parentheses, otherwise the fact will
always be set to False.

While other uses of ternary within this role don't seem to be effected,
update them also for consistency and readability.

Change-Id: I4809ded8b6fe738f8fa700434739ee0b1f6d3af1
2017-02-28 10:36:05 -08:00
Major Hayden
777641e056 Install packages in one step
Installing all packages in one step speeds up the playbook run and is
being used in other roles already.

Change-Id: Iadd07d7979772a49e5f55f612fd95a099924638d
2017-02-22 19:20:49 +00:00
Markos Chandras
c277ab8aa1 tasks: galera_upgrade_check: Fix yum tag
The tag for the 'yum' task should be 'install-yum' instead of
'install-apt'

Change-Id: I6760eca3ca8fe39301ac1edc6d8897e9a4293b45
2017-02-20 15:52:17 +00:00
Jenkins
c80643e848 Merge "Retry galera_running_check after systemctl daemon-reload" 2017-02-15 09:11:02 +00:00
Andy McCrae
841ac16df6 Retry galera_running_check after systemctl daemon-reload
Since the systemctl daemon-reload has been added we're seeing some race
conditions that are causing intermittent failures. We can utilise the
retry option for galera_running_check and ensure the service is running
before continuing.

Change-Id: I7937a71f81862db3de682e45dda62fa0432c31a1
2017-02-13 16:28:31 +00:00
Jenkins
a8aa9d69ec Merge "Update galera running check for CentOS" 2017-02-03 10:33:12 +00:00
Omer Anson
30c73621fa Verify systemd is reloaded after galera post install
In the galera post install playbook, the systemd configuration files are
modified. This change verifies that systemctl daemon-reload is called,
so that these files are re-read, and the configuration is up-to-date.

Closes-Bug: #1656821
Change-Id: I5d8fcf1f2500146fc86db4dd19cd30aaa1055adb
2017-01-31 17:37:02 +02:00
Major Hayden
d898abff4e Update galera running check for CentOS
This patch fixes the galera running checks so that they work
properly on CentOS.

Closes-Bug: 1660445
Change-Id: I7638456239aa23a7e5cd6027d1a399cfdadf4aaa
2017-01-30 15:32:49 -06:00
Jean-Philippe Evrard
323bfc8a19 Allow fallback to Newton default filename
If the deployer decides to override the complete apt repository
git, it would be best to have the possibility to NOT define a
filename, this way it would be the same behavior as in N.

This also allows a combined backport of
https://review.openstack.org/#/c/417362/
to fix bug 1653947 cleanly in Newton.

Change-Id: I00b924275cd9350a93b48f4d886919b597392049
2017-01-09 08:21:55 +00:00
Jenkins
2271abc26e Merge "Remove percona repo if not used" 2017-01-06 21:32:53 +00:00
Jean-Philippe Evrard
2861c4df36 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.

Under ubuntu the galera server would run by default if only doing the
install tag, where it should stay disabled.

Change-Id: Ic23fad68b9ee383559695ab73d6447735f445f51
2017-01-06 13:51:06 +00:00
Jean-Philippe Evrard
2aa7f1ca8a Remove percona repo if not used
If the ``use_percona_upstream`` value is changed from True to False,
don't remove the existing repository. This is also the source of a bug
in Mitaka: We were installing the repo by default and installed the
percona-xtrabackup tool with a deb file. If another playbook/role
installed percona-xtrabackup, it would override (and probably upgrade)
the deb installed version, which is undesired.

Change-Id: I2ccc2904d0d4244dc0792411b49763cc3f7e2e22
Closes-Bug: 1653947
Signed-off-by: Jean-Philippe Evrard <jean-philippe.evrard@rackspace.co.uk>
2017-01-06 12:10:11 +00:00
Jean-Philippe Evrard
3d1ecb7aa2 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: I047bdaf58a4057a96103f6d56c2f811886b1b625
Signed-off-by: Jean-Philippe Evrard <jean-philippe.evrard@rackspace.co.uk>
2017-01-04 09:17:57 +00:00
Andy McCrae
4318ef6c5a Remove Trusty support from galera_server role
NB There was an issue with https://review.openstack.org/#/c/395932/
which meant that "pid1_name != systemd" got changed to
"ansible_service_mgr == systemd" - since we are removing trusty this
task has been removed, but a fix for Newton will be made.

Change-Id: I2f502737e2cc52678cf479de2ef94b818e253622
Implements: blueprint trusty-removal
2016-12-15 13:12:54 +00:00
Jimmy McCrory
fdaf169e1e Install MariaDB 10.1 server
Update repos and packages to install the server for MariaDB 10.1, the
current stable release.

Several improvements have been made to improve the upgrade process and
an upgrade from 10.0 has been included in the test playbooks.

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

Depends-On: I8939703f26e5d8adc393b984266f4cad7a6e0b4c
Change-Id: Ib6409f1fcf4a664b65dbe01372a19509d02d70a4
2016-11-30 10:48:30 -08:00
Andy McCrae
17e28956f0 Don't install client packages via the galera_client role
The galera_server and galera_client roles both configure the apt or
yum repository for galera and percona. This can cause a conflict if
the version of the client and server differ.

This patch sets the galera_client dependency to deploy the /root/.my.cnf
file rather than installing all the client packages as well. The client
package is already deployed as part of the galera_server role
deployment.

Change-Id: I9534a02d4ce827a2f0fdf415a11e37808be941e5
Depends-On: I00d662a8afc7ddd4778787d31dc394a0ea3b1401
2016-11-28 20:44:13 +00:00
Logan V
714b846aad Use ansible_service_mgr fact
This patch removes some extra tasks for detecting systemd and uses
the `ansible_service_mgr` fact instead.

Partial-Bug: #1640125
Change-Id: I1a30b79a759057afb74f24f2239f474b60c1db35
2016-11-11 22:28:52 -06:00
Jimmy McCrory
909fe09ef5 Use arguments parameter with service module
In Ansible 2.2, the 'args' alias for the 'arguments' parameter
of the service module is not recognized correctly.

https://github.com/ansible/ansible-modules-core/issues/5584

Change-Id: I75ee2c5239984ceabf99b5b3da5191697d60d9e1
2016-11-11 20:19:53 -08:00
Jean-Philippe Evrard
8f06602a04 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: Idea4d6beda9b0c62dc15de9f6d8dac7f12f050f9
2016-11-04 15:46:40 +00:00
Logan V
b4148466e4 Fix linting issues for ansible-lint 3.4.1
Preparing this role for the ansible-lint version bump

Change-Id: Ib0c8a23dd03fb1daf4259a3333cf7c6e0a058721
2016-11-01 21:18:09 +00:00
Andy McCrae
9a8fced0f2 Fix MYSQLD_STARTUP_TIMEOUT for systemd
The /etc/default/mysql file needs to be sourced for systemd to start
mysql with the appropriate MYSQLD_STARTUP_TIMEOUT value.

We are already adding the line to source the /etc/default/mysql file in
the init.d/mysql script, but we were skipping dropping the defaults file
when using "systemd".

Additionally, this groups the init file change and the default file
templating to be sequential.

Change-Id: If5dc328e67bde9d84f40c2b192c217e82e1987eb
Closes-Bug: #1634562
2016-10-26 10:11:26 +02:00
Jimmy McCrory
1f056e32c7 Remove duplicate when conditions
The 'galera_upgrade | bool' when clause is already being applied to each
task of the galera_upgrade_pre and galera_upgrade_post task files when
they are included.

Change-Id: I676665aa6230ea2fafa8a90ef7fec1d8eeddf0f8
2016-10-20 10:01:37 -07:00
Jesse Pretorius
e19cff2469 Ensure that yum GPG key add uses correct variable
Change-Id: I6f54b2d429361f0920047930cd432bcdc578a390
2016-10-19 09:17:00 +01:00
Jenkins
165f96c14f Merge "Do not ignore_errors for fallback keyserver" 2016-10-17 18:18:05 +00:00
Kevin Carter
5038acc390 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: I2a40fa9a0da45602a76f2d56611971fcf4063512
Closes-Bug: #1633438
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-10-16 14:45:00 +00:00
Jesse Pretorius
31a6230218 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: I60fdbbde70f9bb14cfdf57e4c357f1cd0fc24f55
2016-10-16 14:33:15 +01:00
Jesse Pretorius
74ac0dc33e Force Ansible to use dynamic includes
Ansible 2.1.1 introduces a regression in the way conditional
includes are handled which results in every task in the
included file being evaluated even if the condition for the
include is not met. This extends the run time significantly
for a deployment.

This patch forces all conditional includes to be dynamic.

Change-Id: I18d8c2119e00aeec3c53cb7e39c8cf09cf5135f8
Related-Bug: https://github.com/ansible/ansible/issues/17687
2016-09-22 12:32:58 +01:00
Kevin Carter
21aaa7cc4f Adjust file descriptor limit when systemd is used
Change-Id: I083c60d28904e6a6eeebd36ed114df06d83072a6
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-09-15 21:26:26 +00:00
Andy McCrae
8a9127efbc Prevent galera_cluster_name from changing.
On a running galera cluster, we don't want to unintentionally allow a
galera_cluster_name from changing. This will cause a cluster to fail to
start (if the nodes are restarted sequentially) as the cluter name value
has changed.

To ensure we can still change this value, a new
"galera_force_change_cluster_name" variable is added, which can be set
to "True" in order to change the cluster name.

Change-Id: I8bae038bd207a15d5731b9c91b78df851a4c1986
2016-09-13 17:32:53 +01:00
Jesse Pretorius
3df31ce349 Rename package lists (and related vars) appropriately
In order to make it easier to differentiate between the lists of
python packages, distribution packages, downloaded packages,
package pins and other similar variables the variable names are
being changed to ensure that they have a more explicit suffix
that defines the purpose and makes the naming more consistent.

This is to facilitate a lookup plugin which will be able to look
up all the package lists and present them as a consolidated piece
of data which may be used for artifact preparation.

Change-Id: Iba040bf8da6ec0552fcf7d10022094dc57d312bc
2016-08-26 15:47:41 +01:00