Auto-fix usage of modules via FQCN
Since ansible-core 2.10 it is recommended to use modules via FQCN In order to align with recommendation, we perform migration by applying suggestions made by `ansible-lint --fix=fqcn` Change-Id: I1ba53c1b0cc33cf7cad8057481275f5757c28b0a
This commit is contained in:
parent
3add3ee734
commit
4fc4459684
@ -14,7 +14,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- name: Check node status
|
- name: Check node status
|
||||||
command: >
|
ansible.builtin.command: >
|
||||||
{{ galera_mariadb_client_binary }} --silent --skip-column-names --connect-timeout=10 -e 'SHOW STATUS LIKE "wsrep_local_state";'
|
{{ galera_mariadb_client_binary }} --silent --skip-column-names --connect-timeout=10 -e 'SHOW STATUS LIKE "wsrep_local_state";'
|
||||||
failed_when: false
|
failed_when: false
|
||||||
changed_when: false
|
changed_when: false
|
||||||
@ -24,7 +24,7 @@
|
|||||||
- cert installed
|
- cert installed
|
||||||
|
|
||||||
- name: Check if node is in the cluster
|
- name: Check if node is in the cluster
|
||||||
command: >
|
ansible.builtin.command: >
|
||||||
{{ galera_mariadb_client_binary }} --silent --skip-column-names --connect-timeout=10 -e 'SHOW STATUS LIKE "wsrep_incoming_addresses";'
|
{{ galera_mariadb_client_binary }} --silent --skip-column-names --connect-timeout=10 -e 'SHOW STATUS LIKE "wsrep_incoming_addresses";'
|
||||||
failed_when: false
|
failed_when: false
|
||||||
changed_when: false
|
changed_when: false
|
||||||
@ -34,21 +34,21 @@
|
|||||||
- cert installed
|
- cert installed
|
||||||
|
|
||||||
- name: Set incoming addresses fact (primary)
|
- name: Set incoming addresses fact (primary)
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
galera_incoming_addresses: "{{ (incoming_addresses.stdout.split()[-1] | default('')).split(',') }}"
|
galera_incoming_addresses: "{{ (incoming_addresses.stdout.split()[-1] | default('')).split(',') }}"
|
||||||
listen:
|
listen:
|
||||||
- Restart all mysql
|
- Restart all mysql
|
||||||
- cert installed
|
- cert installed
|
||||||
|
|
||||||
- name: Set node status fact
|
- name: Set node status fact
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
galera_cluster_ready: "{{ (galera_wsrep_address_port in galera_incoming_addresses) or ((node_status.stdout.split()[-1] | default(false)) in ['2', '4']) }}"
|
galera_cluster_ready: "{{ (galera_wsrep_address_port in galera_incoming_addresses) or ((node_status.stdout.split()[-1] | default(false)) in ['2', '4']) }}"
|
||||||
listen:
|
listen:
|
||||||
- Restart all mysql
|
- Restart all mysql
|
||||||
- cert installed
|
- cert installed
|
||||||
|
|
||||||
- name: Stop mysql
|
- name: Stop mysql
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: "{{ galera_mariadb_service_name }}"
|
name: "{{ galera_mariadb_service_name }}"
|
||||||
state: stopped
|
state: stopped
|
||||||
enabled: true
|
enabled: true
|
||||||
@ -61,7 +61,7 @@
|
|||||||
- not galera_cluster_ready | bool or galera_force_bootstrap | bool
|
- not galera_cluster_ready | bool or galera_force_bootstrap | bool
|
||||||
|
|
||||||
- name: Start new cluster
|
- name: Start new cluster
|
||||||
command: /usr/local/bin/galera_new_cluster
|
ansible.builtin.command: /usr/local/bin/galera_new_cluster
|
||||||
failed_when: not start_new_cluster.rc in [0, 3]
|
failed_when: not start_new_cluster.rc in [0, 3]
|
||||||
changed_when: start_new_cluster.rc == 3
|
changed_when: start_new_cluster.rc == 3
|
||||||
register: start_new_cluster
|
register: start_new_cluster
|
||||||
@ -75,7 +75,7 @@
|
|||||||
- cert installed
|
- cert installed
|
||||||
|
|
||||||
- name: Restart mysql (All)
|
- name: Restart mysql (All)
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: "{{ galera_mariadb_service_name }}"
|
name: "{{ galera_mariadb_service_name }}"
|
||||||
state: "{{ (not hostvars[item]['galera_cluster_ready'] | bool or galera_force_bootstrap | bool) | ternary('started', 'restarted') }}"
|
state: "{{ (not hostvars[item]['galera_cluster_ready'] | bool or galera_force_bootstrap | bool) | ternary('started', 'restarted') }}"
|
||||||
enabled: true
|
enabled: true
|
||||||
@ -98,7 +98,7 @@
|
|||||||
- cert installed
|
- cert installed
|
||||||
|
|
||||||
- name: Delete encryption keyfile after starting Galera
|
- name: Delete encryption keyfile after starting Galera
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "/tmp/.keyfile.key"
|
path: "/tmp/.keyfile.key"
|
||||||
state: absent
|
state: absent
|
||||||
when: galera_restart is changed
|
when: galera_restart is changed
|
||||||
|
@ -14,19 +14,18 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- name: Prepare the package list
|
- name: Prepare the package list
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
galera_packages_list: "{{ galera_client_distro_packages }}"
|
galera_packages_list: "{{ galera_client_distro_packages }}"
|
||||||
|
|
||||||
- name: Including distro-specific installation tasks
|
- name: Including distro-specific installation tasks
|
||||||
include_tasks: "galera_install_{{ ansible_facts['pkg_mgr'] }}.yml"
|
ansible.builtin.include_tasks: "galera_install_{{ ansible_facts['pkg_mgr'] }}.yml"
|
||||||
when:
|
when:
|
||||||
- galera_client_package_install | bool
|
- galera_client_package_install | bool
|
||||||
|
|
||||||
- name: Including galera_client_post_install
|
- name: Including galera_client_post_install
|
||||||
include_tasks: galera_client_post_install.yml
|
ansible.builtin.include_tasks: galera_client_post_install.yml
|
||||||
|
|
||||||
- name: Create and install SSL certificates
|
- name: Create and install SSL certificates
|
||||||
include_role:
|
ansible.builtin.include_role:
|
||||||
name: pki
|
name: pki
|
||||||
tasks_from: "main_certs.yml"
|
tasks_from: "main_certs.yml"
|
||||||
vars:
|
vars:
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- name: Prepare the package list
|
- name: Prepare the package list
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
galera_packages_list: "{{ galera_devel_distro_packages }}"
|
galera_packages_list: "{{ galera_devel_distro_packages }}"
|
||||||
|
|
||||||
- name: Including distro-specific installation tasks
|
- name: Including distro-specific installation tasks
|
||||||
include_tasks: "galera_install_{{ ansible_facts['pkg_mgr'] }}.yml"
|
ansible.builtin.include_tasks: "galera_install_{{ ansible_facts['pkg_mgr'] }}.yml"
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
fail_msg: "The following repository definitions must be updated to deb822 format {{ _repo_check }}"
|
fail_msg: "The following repository definitions must be updated to deb822 format {{ _repo_check }}"
|
||||||
|
|
||||||
- name: Remove conflicting distro packages
|
- name: Remove conflicting distro packages
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: "{{ galera_mariadb_distro_packages_remove | default([]) }}"
|
name: "{{ galera_mariadb_distro_packages_remove | default([]) }}"
|
||||||
state: absent
|
state: absent
|
||||||
when: galera_install_method == 'external_repo'
|
when: galera_install_method == 'external_repo'
|
||||||
@ -31,14 +31,14 @@
|
|||||||
vars:
|
vars:
|
||||||
galera_apt_repo_cleanup:
|
galera_apt_repo_cleanup:
|
||||||
- MariaDB.list
|
- MariaDB.list
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "/etc/apt/sources.list.d/{{ item }}"
|
path: "/etc/apt/sources.list.d/{{ item }}"
|
||||||
state: absent
|
state: absent
|
||||||
with_items: "{{ galera_apt_repo_cleanup }}"
|
with_items: "{{ galera_apt_repo_cleanup }}"
|
||||||
register: apt_repo_removed
|
register: apt_repo_removed
|
||||||
|
|
||||||
- name: Ensure python3-debian package is available
|
- name: Ensure python3-debian package is available
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: python3-debian
|
name: python3-debian
|
||||||
|
|
||||||
- name: Manage apt repositories
|
- name: Manage apt repositories
|
||||||
@ -69,12 +69,12 @@
|
|||||||
register: deb822_repos
|
register: deb822_repos
|
||||||
|
|
||||||
- name: Update apt repositories when config is changed
|
- name: Update apt repositories when config is changed
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
update_cache: true
|
update_cache: true
|
||||||
when: (apt_repo_removed is changed) or (deb822_repos is changed)
|
when: (apt_repo_removed is changed) or (deb822_repos is changed)
|
||||||
|
|
||||||
- name: Preseed galera password(s)
|
- name: Preseed galera password(s)
|
||||||
debconf:
|
ansible.builtin.debconf:
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
question: "{{ item.question }}"
|
question: "{{ item.question }}"
|
||||||
value: "{{ item.value }}"
|
value: "{{ item.value }}"
|
||||||
@ -83,7 +83,7 @@
|
|||||||
no_log: true
|
no_log: true
|
||||||
|
|
||||||
- name: Install galera role remote packages (apt)
|
- name: Install galera role remote packages (apt)
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: "{{ galera_packages_list }}"
|
name: "{{ galera_packages_list }}"
|
||||||
state: "{{ galera_package_state }}"
|
state: "{{ galera_package_state }}"
|
||||||
policy_rc_d: 101
|
policy_rc_d: 101
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
# dependencies, otherwise for distro package installation types on shared
|
# dependencies, otherwise for distro package installation types on shared
|
||||||
# hosts it removes far too many packages.
|
# hosts it removes far too many packages.
|
||||||
- name: Remove conflicting packages
|
- name: Remove conflicting packages
|
||||||
shell: |
|
ansible.builtin.shell: |
|
||||||
exit_code=0
|
exit_code=0
|
||||||
for pkg in {{ galera_mariadb_distro_packages_remove | join(' ') }}; do
|
for pkg in {{ galera_mariadb_distro_packages_remove | join(' ') }}; do
|
||||||
if rpm --query --quiet ${pkg}; then
|
if rpm --query --quiet ${pkg}; then
|
||||||
@ -41,7 +41,7 @@
|
|||||||
# that we can replace it with symlinks to the directories expected
|
# that we can replace it with symlinks to the directories expected
|
||||||
# to be used by the MariaDB packages instead.
|
# to be used by the MariaDB packages instead.
|
||||||
- name: Stat /etc/my.cnf.d
|
- name: Stat /etc/my.cnf.d
|
||||||
stat:
|
ansible.builtin.stat:
|
||||||
path: /etc/my.cnf.d
|
path: /etc/my.cnf.d
|
||||||
get_attributes: false
|
get_attributes: false
|
||||||
get_checksum: false
|
get_checksum: false
|
||||||
@ -49,7 +49,7 @@
|
|||||||
register: mycnfd_stat
|
register: mycnfd_stat
|
||||||
|
|
||||||
- name: Destroy my.cnf.d dir if is dir
|
- name: Destroy my.cnf.d dir if is dir
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: /etc/my.cnf.d
|
path: /etc/my.cnf.d
|
||||||
state: absent
|
state: absent
|
||||||
force: true
|
force: true
|
||||||
@ -61,7 +61,7 @@
|
|||||||
# the paths used by the MariaDB packages so ensure that any other
|
# the paths used by the MariaDB packages so ensure that any other
|
||||||
# system expectations are still met.
|
# system expectations are still met.
|
||||||
- name: Update the local file system CRUD
|
- name: Update the local file system CRUD
|
||||||
file:
|
ansible.builtin.file:
|
||||||
src: "{{ item.src | default(omit) }}"
|
src: "{{ item.src | default(omit) }}"
|
||||||
path: "{{ item.path }}"
|
path: "{{ item.path }}"
|
||||||
state: "{{ item.state }}"
|
state: "{{ item.state }}"
|
||||||
@ -87,7 +87,7 @@
|
|||||||
force: true
|
force: true
|
||||||
|
|
||||||
- name: If a keyfile is provided, copy the gpg keyfile to the key location
|
- name: If a keyfile is provided, copy the gpg keyfile to the key location
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src: "gpg/{{ item.key | basename }}"
|
src: "gpg/{{ item.key | basename }}"
|
||||||
dest: "{{ item.key }}"
|
dest: "{{ item.key }}"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
@ -96,7 +96,7 @@
|
|||||||
- galera_install_method == 'external_repo'
|
- galera_install_method == 'external_repo'
|
||||||
|
|
||||||
- name: Add galera repo
|
- name: Add galera repo
|
||||||
yum_repository:
|
ansible.builtin.yum_repository:
|
||||||
name: "{{ galera_repo.name }}"
|
name: "{{ galera_repo.name }}"
|
||||||
description: "{{ galera_repo.description }}"
|
description: "{{ galera_repo.description }}"
|
||||||
baseurl: "{{ galera_repo.baseurl }}"
|
baseurl: "{{ galera_repo.baseurl }}"
|
||||||
@ -112,7 +112,7 @@
|
|||||||
delay: 2
|
delay: 2
|
||||||
|
|
||||||
- name: Install galera role remote packages
|
- name: Install galera role remote packages
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: "{{ galera_packages_list }}"
|
name: "{{ galera_packages_list }}"
|
||||||
state: "{{ galera_package_state }}"
|
state: "{{ galera_package_state }}"
|
||||||
register: install_remote_packages
|
register: install_remote_packages
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
---
|
---
|
||||||
- name: Ensure group backups exists
|
- name: Ensure group backups exists
|
||||||
group:
|
ansible.builtin.group:
|
||||||
name: "{{ galera_mariadb_backups_group_name }}"
|
name: "{{ galera_mariadb_backups_group_name }}"
|
||||||
state: present
|
state: present
|
||||||
gid: "{{ galera_mariadb_backups_group_gid | default(omit) }}"
|
gid: "{{ galera_mariadb_backups_group_gid | default(omit) }}"
|
||||||
|
|
||||||
- name: Create mariadb back up directory
|
- name: Create mariadb back up directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ galera_mariadb_backups_path }}"
|
path: "{{ galera_mariadb_backups_path }}"
|
||||||
state: "directory"
|
state: "directory"
|
||||||
owner: "mysql"
|
owner: "mysql"
|
||||||
@ -14,19 +14,19 @@
|
|||||||
mode: "0750"
|
mode: "0750"
|
||||||
|
|
||||||
- name: Template out mariadb backup script
|
- name: Template out mariadb backup script
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: "mariabackup_script.py.j2"
|
src: "mariabackup_script.py.j2"
|
||||||
dest: "{{ galera_mariadb_backups_path }}/mariabackup_script.py"
|
dest: "{{ galera_mariadb_backups_path }}/mariabackup_script.py"
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
|
|
||||||
- name: Template out mariabackup cnf file
|
- name: Template out mariabackup cnf file
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: "mariabackup.cnf.j2"
|
src: "mariabackup.cnf.j2"
|
||||||
dest: "{{ galera_mariadb_backups_cnf_file }}"
|
dest: "{{ galera_mariadb_backups_cnf_file }}"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
|
|
||||||
- name: Create service and timer for full backups
|
- name: Create service and timer for full backups
|
||||||
import_role:
|
ansible.builtin.import_role:
|
||||||
name: systemd_service
|
name: systemd_service
|
||||||
vars:
|
vars:
|
||||||
systemd_service_enabled: true
|
systemd_service_enabled: true
|
||||||
@ -55,7 +55,7 @@
|
|||||||
Unit: "mariabackup-full.service"
|
Unit: "mariabackup-full.service"
|
||||||
|
|
||||||
- name: Create service and timer for incremental backups
|
- name: Create service and timer for incremental backups
|
||||||
import_role:
|
ansible.builtin.import_role:
|
||||||
name: systemd_service
|
name: systemd_service
|
||||||
vars:
|
vars:
|
||||||
systemd_service_enabled: true
|
systemd_service_enabled: true
|
||||||
|
@ -14,14 +14,14 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- name: Check node status
|
- name: Check node status
|
||||||
command: >
|
ansible.builtin.command: >
|
||||||
{{ galera_mariadb_client_binary }} --silent --skip-column-names --connect-timeout=10 -e 'SHOW STATUS LIKE "wsrep_local_state";'
|
{{ galera_mariadb_client_binary }} --silent --skip-column-names --connect-timeout=10 -e 'SHOW STATUS LIKE "wsrep_local_state";'
|
||||||
failed_when: false
|
failed_when: false
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: _node_status
|
register: _node_status
|
||||||
|
|
||||||
- name: Fail if cluster is out of sync
|
- name: Fail if cluster is out of sync
|
||||||
fail:
|
ansible.builtin.fail:
|
||||||
msg: >
|
msg: >
|
||||||
The cluster may be broken, the cluster state is not known to be good.
|
The cluster may be broken, the cluster state is not known to be good.
|
||||||
Fix the cluster state before re-running the playbooks. To ignore the
|
Fix the cluster state before re-running the playbooks. To ignore the
|
||||||
@ -32,14 +32,14 @@
|
|||||||
or (_node_status.stdout.split()[-1] | default(false)) not in ["2", "4"]
|
or (_node_status.stdout.split()[-1] | default(false)) not in ["2", "4"]
|
||||||
|
|
||||||
- name: Check cluster name
|
- name: Check cluster name
|
||||||
command: >
|
ansible.builtin.command: >
|
||||||
{{ galera_mariadb_client_binary }} --silent --skip-column-names --connect-timeout=10 -e 'SHOW VARIABLES LIKE "wsrep_cluster_name";'
|
{{ galera_mariadb_client_binary }} --silent --skip-column-names --connect-timeout=10 -e 'SHOW VARIABLES LIKE "wsrep_cluster_name";'
|
||||||
failed_when: false
|
failed_when: false
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: _cluster_name
|
register: _cluster_name
|
||||||
|
|
||||||
- name: Fail if galera_cluster_name doesnt match provided value
|
- name: Fail if galera_cluster_name doesnt match provided value
|
||||||
fail:
|
ansible.builtin.fail:
|
||||||
msg: >
|
msg: >
|
||||||
The galera_cluster_name variable does not match what is set in mysql.
|
The galera_cluster_name variable does not match what is set in mysql.
|
||||||
Check your galera_cluster_name setting in your user_*.yml files in
|
Check your galera_cluster_name setting in your user_*.yml files in
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
- name: Use encryption with the file key management plugin
|
- name: Use encryption with the file key management plugin
|
||||||
block:
|
block:
|
||||||
- name: Create encryption directory
|
- name: Create encryption directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "/etc/mysql/encryption"
|
path: "/etc/mysql/encryption"
|
||||||
state: "directory"
|
state: "directory"
|
||||||
owner: "mysql"
|
owner: "mysql"
|
||||||
@ -40,14 +40,14 @@
|
|||||||
mode: "0755"
|
mode: "0755"
|
||||||
|
|
||||||
- name: Create a fact for the name of the temporary directory
|
- name: Create a fact for the name of the temporary directory
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
galera_db_encryption_tmp_dir: "{{ lookup('env', 'OSA_CONFIG_DIR') | default(osa_config_dir, True) }}/mysql"
|
galera_db_encryption_tmp_dir: "{{ lookup('env', 'OSA_CONFIG_DIR') | default(osa_config_dir, True) }}/mysql"
|
||||||
delegate_to: "localhost"
|
delegate_to: "localhost"
|
||||||
run_once: true
|
run_once: true
|
||||||
when: galera_db_encryption_tmp_dir | length == 0
|
when: galera_db_encryption_tmp_dir | length == 0
|
||||||
|
|
||||||
- name: Create a temporary directory to store the keyfile
|
- name: Create a temporary directory to store the keyfile
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ galera_db_encryption_tmp_dir }}"
|
path: "{{ galera_db_encryption_tmp_dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: "0750"
|
mode: "0750"
|
||||||
@ -55,21 +55,22 @@
|
|||||||
run_once: true
|
run_once: true
|
||||||
|
|
||||||
- name: Create encryption keys if the user does not specify them and put them on the deploy host # noqa: no-changed-when risky-shell-pipe
|
- name: Create encryption keys if the user does not specify them and put them on the deploy host # noqa: no-changed-when risky-shell-pipe
|
||||||
shell: "for i in {1..2}; do echo \"$i;$(openssl rand -hex 32)\"; done | tee {{ galera_db_encryption_tmp_dir }}/mysql_encryption_keys > /dev/null"
|
ansible.builtin.shell: >-
|
||||||
|
for i in {1..2}; do echo \"$i;$(openssl rand -hex 32)\"; done | tee {{ galera_db_encryption_tmp_dir }}/mysql_encryption_keys > /dev/null
|
||||||
delegate_to: "localhost"
|
delegate_to: "localhost"
|
||||||
run_once: true
|
run_once: true
|
||||||
when:
|
when:
|
||||||
- galera_db_encryption_keys is not defined
|
- galera_db_encryption_keys is not defined
|
||||||
|
|
||||||
- name: Create the encryption key file from the user provided galera_db_encryption_keys
|
- name: Create the encryption key file from the user provided galera_db_encryption_keys
|
||||||
shell: "echo '{{ galera_db_encryption_keys }}' > {{ galera_db_encryption_tmp_dir }}/mysql_encryption_keys" # noqa: no-changed-when
|
ansible.builtin.shell: "echo '{{ galera_db_encryption_keys }}' > {{ galera_db_encryption_tmp_dir }}/mysql_encryption_keys" # noqa: no-changed-when
|
||||||
delegate_to: "localhost"
|
delegate_to: "localhost"
|
||||||
run_once: true
|
run_once: true
|
||||||
when:
|
when:
|
||||||
- galera_db_encryption_keys is defined
|
- galera_db_encryption_keys is defined
|
||||||
|
|
||||||
- name: Create an encrypted keyfile using encryption key
|
- name: Create an encrypted keyfile using encryption key
|
||||||
command: # noqa: no-changed-when
|
ansible.builtin.command: # noqa: no-changed-when
|
||||||
argv:
|
argv:
|
||||||
- openssl
|
- openssl
|
||||||
- enc
|
- enc
|
||||||
@ -86,7 +87,7 @@
|
|||||||
run_once: true
|
run_once: true
|
||||||
|
|
||||||
- name: Copy encypted keyfile to servers
|
- name: Copy encypted keyfile to servers
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ galera_db_encryption_tmp_dir }}/mysql_encryption_keyfile.enc"
|
src: "{{ galera_db_encryption_tmp_dir }}/mysql_encryption_keyfile.enc"
|
||||||
dest: "/etc/mysql/encryption/keyfile.enc"
|
dest: "/etc/mysql/encryption/keyfile.enc"
|
||||||
owner: mysql
|
owner: mysql
|
||||||
@ -96,7 +97,7 @@
|
|||||||
notify: Restart all mysql
|
notify: Restart all mysql
|
||||||
|
|
||||||
- name: Copy password to file to servers
|
- name: Copy password to file to servers
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
content: "{{ galera_db_encryption_password }}"
|
content: "{{ galera_db_encryption_password }}"
|
||||||
dest: "/etc/mysql/encryption/.keyfile.key"
|
dest: "/etc/mysql/encryption/.keyfile.key"
|
||||||
owner: mysql
|
owner: mysql
|
||||||
|
@ -14,21 +14,20 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- name: Prepare the package list
|
- name: Prepare the package list
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
galera_packages_list: "{{ galera_server_required_distro_packages + galera_server_mariadb_distro_packages }}"
|
galera_packages_list: "{{ galera_server_required_distro_packages + galera_server_mariadb_distro_packages }}"
|
||||||
|
|
||||||
- name: Including distro-specific installation tasks
|
- name: Including distro-specific installation tasks
|
||||||
include_tasks: "galera_install_{{ ansible_facts['pkg_mgr'] }}.yml"
|
ansible.builtin.include_tasks: "galera_install_{{ ansible_facts['pkg_mgr'] }}.yml"
|
||||||
|
|
||||||
- name: Including galera_server_encryption
|
- name: Including galera_server_encryption
|
||||||
include_tasks: galera_server_encryption.yml
|
ansible.builtin.include_tasks: galera_server_encryption.yml
|
||||||
when:
|
when:
|
||||||
- galera_mariadb_encryption_enabled | bool
|
- galera_mariadb_encryption_enabled | bool
|
||||||
tags:
|
tags:
|
||||||
- galera_server-encryption
|
- galera_server-encryption
|
||||||
|
|
||||||
- name: Record galera has been deployed
|
- name: Record galera has been deployed
|
||||||
ini_file:
|
community.general.ini_file:
|
||||||
dest: "/etc/ansible/facts.d/openstack_ansible.fact"
|
dest: "/etc/ansible/facts.d/openstack_ansible.fact"
|
||||||
section: galera
|
section: galera
|
||||||
option: deployed
|
option: deployed
|
||||||
@ -36,5 +35,5 @@
|
|||||||
mode: "0644"
|
mode: "0644"
|
||||||
|
|
||||||
- name: Set the galera existing cluster fact
|
- name: Set the galera existing cluster fact
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
galera_deployed: true
|
galera_deployed: true
|
||||||
|
@ -14,14 +14,14 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- name: Fail when the host is not in galera_cluster_members
|
- name: Fail when the host is not in galera_cluster_members
|
||||||
fail:
|
ansible.builtin.fail:
|
||||||
msg: "The host {{ inventory_hostname }} must be in galera_cluster_members."
|
msg: "The host {{ inventory_hostname }} must be in galera_cluster_members."
|
||||||
when: inventory_hostname not in galera_cluster_members
|
when: inventory_hostname not in galera_cluster_members
|
||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
|
|
||||||
- name: Fail if the galera root password is not provided
|
- name: Fail if the galera root password is not provided
|
||||||
fail:
|
ansible.builtin.fail:
|
||||||
msg: |
|
msg: |
|
||||||
Please set the galera_root_password variable prior to applying the
|
Please set the galera_root_password variable prior to applying the
|
||||||
galera role.
|
galera role.
|
||||||
@ -30,7 +30,7 @@
|
|||||||
- always
|
- always
|
||||||
|
|
||||||
- name: Initialize local facts
|
- name: Initialize local facts
|
||||||
ini_file:
|
community.general.ini_file:
|
||||||
dest: "/etc/ansible/facts.d/openstack_ansible.fact"
|
dest: "/etc/ansible/facts.d/openstack_ansible.fact"
|
||||||
section: "galera"
|
section: "galera"
|
||||||
option: initialized
|
option: initialized
|
||||||
@ -38,20 +38,20 @@
|
|||||||
mode: "0644"
|
mode: "0644"
|
||||||
|
|
||||||
- name: Refresh local facts
|
- name: Refresh local facts
|
||||||
setup:
|
ansible.builtin.setup:
|
||||||
filter: ansible_local
|
filter: ansible_local
|
||||||
gather_subset: "!all"
|
gather_subset: "!all"
|
||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
|
|
||||||
- name: Set the galera existing cluster fact
|
- name: Set the galera existing cluster fact
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
galera_deployed: "{{ ansible_local['openstack_ansible']['galera']['deployed'] | default(false) | bool }}"
|
galera_deployed: "{{ ansible_local['openstack_ansible']['galera']['deployed'] | default(false) | bool }}"
|
||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
|
|
||||||
- name: Cluster state notice
|
- name: Cluster state notice
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
msg: >
|
msg: >
|
||||||
The cluster state will be ignored. While the state checks are skipped,
|
The cluster state will be ignored. While the state checks are skipped,
|
||||||
the galera restart handlers will be triggered to ensure everything is
|
the galera restart handlers will be triggered to ensure everything is
|
||||||
@ -65,7 +65,7 @@
|
|||||||
- always
|
- always
|
||||||
|
|
||||||
- name: Including galera_server_cluster_state
|
- name: Including galera_server_cluster_state
|
||||||
include_tasks: galera_server_cluster_state.yml
|
ansible.builtin.include_tasks: galera_server_cluster_state.yml
|
||||||
when:
|
when:
|
||||||
- galera_deployed | bool
|
- galera_deployed | bool
|
||||||
- not galera_ignore_cluster_state | bool
|
- not galera_ignore_cluster_state | bool
|
||||||
@ -73,7 +73,7 @@
|
|||||||
- always
|
- always
|
||||||
|
|
||||||
- name: Including galera_server_upgrade
|
- name: Including galera_server_upgrade
|
||||||
include_tasks: galera_server_upgrade.yml
|
ansible.builtin.include_tasks: galera_server_upgrade.yml
|
||||||
when: galera_deployed | bool
|
when: galera_deployed | bool
|
||||||
args:
|
args:
|
||||||
apply:
|
apply:
|
||||||
@ -83,7 +83,7 @@
|
|||||||
- always
|
- always
|
||||||
|
|
||||||
- name: Including galera_server_install
|
- name: Including galera_server_install
|
||||||
include_tasks: galera_server_install.yml
|
ansible.builtin.include_tasks: galera_server_install.yml
|
||||||
args:
|
args:
|
||||||
apply:
|
apply:
|
||||||
tags:
|
tags:
|
||||||
@ -92,7 +92,7 @@
|
|||||||
- always
|
- always
|
||||||
|
|
||||||
- name: Including galera_server_post_install
|
- name: Including galera_server_post_install
|
||||||
include_tasks: galera_server_post_install.yml
|
ansible.builtin.include_tasks: galera_server_post_install.yml
|
||||||
args:
|
args:
|
||||||
apply:
|
apply:
|
||||||
tags:
|
tags:
|
||||||
@ -101,10 +101,9 @@
|
|||||||
- always
|
- always
|
||||||
|
|
||||||
- name: Flush handlers
|
- name: Flush handlers
|
||||||
meta: flush_handlers
|
ansible.builtin.meta: flush_handlers
|
||||||
|
|
||||||
- name: Including galera_server_setup
|
- name: Including galera_server_setup
|
||||||
include_tasks: galera_server_setup.yml
|
ansible.builtin.include_tasks: galera_server_setup.yml
|
||||||
when: inventory_hostname == galera_server_bootstrap_node
|
when: inventory_hostname == galera_server_bootstrap_node
|
||||||
args:
|
args:
|
||||||
apply:
|
apply:
|
||||||
@ -114,7 +113,7 @@
|
|||||||
- always
|
- always
|
||||||
|
|
||||||
- name: Including galera_server_backups
|
- name: Including galera_server_backups
|
||||||
include_tasks: galera_server_backups.yml
|
ansible.builtin.include_tasks: galera_server_backups.yml
|
||||||
when:
|
when:
|
||||||
- galera_mariadb_backups_enabled | bool
|
- galera_mariadb_backups_enabled | bool
|
||||||
- inventory_hostname in galera_mariadb_backups_nodes
|
- inventory_hostname in galera_mariadb_backups_nodes
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- name: Run the systemd service role
|
- name: Run the systemd service role
|
||||||
import_role:
|
ansible.builtin.import_role:
|
||||||
name: systemd_service
|
name: systemd_service
|
||||||
vars:
|
vars:
|
||||||
systemd_tempd_prefix: openstack
|
systemd_tempd_prefix: openstack
|
||||||
@ -46,7 +46,7 @@
|
|||||||
# and running them again will cause a conflict within
|
# and running them again will cause a conflict within
|
||||||
# debian based deployments.
|
# debian based deployments.
|
||||||
- name: Create galera initial secure tool
|
- name: Create galera initial secure tool
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: "galera_secure_node.j2"
|
src: "galera_secure_node.j2"
|
||||||
dest: "/usr/local/bin/galera_secure_node"
|
dest: "/usr/local/bin/galera_secure_node"
|
||||||
mode: "0750"
|
mode: "0750"
|
||||||
@ -66,7 +66,7 @@
|
|||||||
- molecule-idempotence-notest
|
- molecule-idempotence-notest
|
||||||
|
|
||||||
- name: Create the local directories
|
- name: Create the local directories
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ item.path }}"
|
path: "{{ item.path }}"
|
||||||
state: "directory"
|
state: "directory"
|
||||||
owner: "{{ item.owner | default('root') }}"
|
owner: "{{ item.owner | default('root') }}"
|
||||||
@ -75,13 +75,13 @@
|
|||||||
recurse: "{{ item.recurse | default('false') }}"
|
recurse: "{{ item.recurse | default('false') }}"
|
||||||
with_items:
|
with_items:
|
||||||
- { path: "{{ galera_data_dir }}", owner: "mysql", mode: "02755" }
|
- { path: "{{ galera_data_dir }}", owner: "mysql", mode: "02755" }
|
||||||
- { path: "{{ galera_tmp_dir }}", owner: "mysql", mode: "02755" } # TMP needs to be re-created after clustering, so breaks idempotence test on all[1:]
|
- { path: "{{ galera_tmp_dir }}", owner: "mysql", mode: "02755" } # TMP needs to be re-created after clustering, so breaks idempotence test on all[1:]
|
||||||
- { path: "/etc/mysql/conf.d" }
|
- { path: "/etc/mysql/conf.d" }
|
||||||
tags:
|
tags:
|
||||||
- molecule-idempotence-notest
|
- molecule-idempotence-notest
|
||||||
|
|
||||||
- name: Create and install SSL certificates
|
- name: Create and install SSL certificates
|
||||||
include_role:
|
ansible.builtin.include_role:
|
||||||
name: pki
|
name: pki
|
||||||
tasks_from: "{{ galera_pki_create_ca | ternary('main.yml', 'main_certs.yml') }}"
|
tasks_from: "{{ galera_pki_create_ca | ternary('main.yml', 'main_certs.yml') }}"
|
||||||
vars:
|
vars:
|
||||||
@ -102,7 +102,7 @@
|
|||||||
# in {{ galera_etc_include_dir }} so make sure they are gone if necessary in
|
# in {{ galera_etc_include_dir }} so make sure they are gone if necessary in
|
||||||
# case they cause some conflicts with the ones we provide.
|
# case they cause some conflicts with the ones we provide.
|
||||||
- name: Remove existing mariadb configuration files
|
- name: Remove existing mariadb configuration files
|
||||||
file:
|
ansible.builtin.file:
|
||||||
state: absent
|
state: absent
|
||||||
path: "{{ galera_etc_include_dir }}/{{ item }}"
|
path: "{{ galera_etc_include_dir }}/{{ item }}"
|
||||||
with_items: "{{ mariadb_delete_etc_conf_files | default([]) }}"
|
with_items: "{{ mariadb_delete_etc_conf_files | default([]) }}"
|
||||||
@ -142,7 +142,7 @@
|
|||||||
- Restart all mysql
|
- Restart all mysql
|
||||||
|
|
||||||
- name: Apply service defaults
|
- name: Apply service defaults
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: "mysql_defaults.j2"
|
src: "mysql_defaults.j2"
|
||||||
dest: "/etc/default/mariadb"
|
dest: "/etc/default/mariadb"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
@ -150,25 +150,25 @@
|
|||||||
- Restart all mysql
|
- Restart all mysql
|
||||||
|
|
||||||
- name: Link mysql and mariadb config files
|
- name: Link mysql and mariadb config files
|
||||||
file:
|
ansible.builtin.file:
|
||||||
src: "/etc/default/mariadb"
|
src: "/etc/default/mariadb"
|
||||||
dest: "/etc/default/mysql"
|
dest: "/etc/default/mysql"
|
||||||
state: "link"
|
state: "link"
|
||||||
force: "yes"
|
force: "yes"
|
||||||
|
|
||||||
- name: Remove default mysql_safe_syslog
|
- name: Remove default mysql_safe_syslog
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "/etc/mysql/conf.d/mysqld_safe_syslog.cnf"
|
path: "/etc/mysql/conf.d/mysqld_safe_syslog.cnf"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Create new cluster tool
|
- name: Create new cluster tool
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: "galera_new_cluster.j2"
|
src: "galera_new_cluster.j2"
|
||||||
dest: "/usr/local/bin/galera_new_cluster"
|
dest: "/usr/local/bin/galera_new_cluster"
|
||||||
mode: "0750"
|
mode: "0750"
|
||||||
|
|
||||||
- name: Create clustercheck script
|
- name: Create clustercheck script
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: "clustercheck.j2"
|
src: "clustercheck.j2"
|
||||||
dest: "/usr/local/bin/clustercheck"
|
dest: "/usr/local/bin/clustercheck"
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
|
@ -16,13 +16,13 @@
|
|||||||
- name: Run mysql_upgrade
|
- name: Run mysql_upgrade
|
||||||
block:
|
block:
|
||||||
- name: Fail if upgrade is needed
|
- name: Fail if upgrade is needed
|
||||||
command: /usr/bin/mariadb-upgrade --check-if-upgrade-is-needed
|
ansible.builtin.command: /usr/bin/mariadb-upgrade --check-if-upgrade-is-needed
|
||||||
register: galera_upgrade_check
|
register: galera_upgrade_check
|
||||||
failed_when: galera_upgrade_check.rc == 0
|
failed_when: galera_upgrade_check.rc == 0
|
||||||
changed_when: false
|
changed_when: false
|
||||||
rescue:
|
rescue:
|
||||||
- name: Run MySQL Upgrade
|
- name: Run MySQL Upgrade
|
||||||
command: /usr/bin/mariadb-upgrade
|
ansible.builtin.command: /usr/bin/mariadb-upgrade
|
||||||
register: galera_mysql_upgrade
|
register: galera_mysql_upgrade
|
||||||
changed_when:
|
changed_when:
|
||||||
- not galera_mysql_upgrade.stdout is search("already upgraded")
|
- not galera_mysql_upgrade.stdout is search("already upgraded")
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
- skip_ansible_lint
|
- skip_ansible_lint
|
||||||
|
|
||||||
- name: Check if major version of Galera is installed
|
- name: Check if major version of Galera is installed
|
||||||
fail:
|
ansible.builtin.fail:
|
||||||
msg: >
|
msg: >
|
||||||
To install a new major version of mariadb-galera-server set
|
To install a new major version of mariadb-galera-server set
|
||||||
'-e galera_upgrade=true'.
|
'-e galera_upgrade=true'.
|
||||||
@ -38,7 +38,7 @@
|
|||||||
- galera_server-upgrade
|
- galera_server-upgrade
|
||||||
|
|
||||||
- name: Including galera_server_upgrade_pre
|
- name: Including galera_server_upgrade_pre
|
||||||
include_tasks: galera_server_upgrade_pre.yml
|
ansible.builtin.include_tasks: galera_server_upgrade_pre.yml
|
||||||
when:
|
when:
|
||||||
- galera_upgrade | bool
|
- galera_upgrade | bool
|
||||||
args:
|
args:
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
# cause the service stop task to fail. To cater for this
|
# cause the service stop task to fail. To cater for this
|
||||||
# we only try to stop the service is it exists.
|
# we only try to stop the service is it exists.
|
||||||
- name: Check whether a mysql service exists yet # noqa command-instead-of-module risky-shell-pipe
|
- name: Check whether a mysql service exists yet # noqa command-instead-of-module risky-shell-pipe
|
||||||
shell: systemctl list-unit-files --state=enabled --type=service | grep "^{{ galera_mariadb_service_name }}.service .* enabled$"
|
ansible.builtin.shell: systemctl list-unit-files --state=enabled --type=service | grep "^{{ galera_mariadb_service_name }}.service .* enabled$"
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
@ -26,7 +26,7 @@
|
|||||||
register: _mysql_service_exists
|
register: _mysql_service_exists
|
||||||
|
|
||||||
- name: Stop MariaDB
|
- name: Stop MariaDB
|
||||||
systemd:
|
ansible.builtin.systemd:
|
||||||
name: "{{ galera_mariadb_service_name }}"
|
name: "{{ galera_mariadb_service_name }}"
|
||||||
state: stopped
|
state: stopped
|
||||||
register: galera_restart_fall_back
|
register: galera_restart_fall_back
|
||||||
@ -37,7 +37,7 @@
|
|||||||
- _mysql_service_exists.rc == 0
|
- _mysql_service_exists.rc == 0
|
||||||
|
|
||||||
- name: UN-Install galera-server package
|
- name: UN-Install galera-server package
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: absent
|
state: absent
|
||||||
with_items:
|
with_items:
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- name: Gather variables for each operating system
|
- name: Gather variables for each operating system
|
||||||
include_vars: "{{ lookup('first_found', params) }}"
|
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
|
||||||
vars:
|
vars:
|
||||||
params:
|
params:
|
||||||
files:
|
files:
|
||||||
@ -29,7 +29,7 @@
|
|||||||
- always
|
- always
|
||||||
|
|
||||||
- name: Including galera_client_main
|
- name: Including galera_client_main
|
||||||
include_tasks: galera_client_main.yml
|
ansible.builtin.include_tasks: galera_client_main.yml
|
||||||
when:
|
when:
|
||||||
- galera_install_client | bool
|
- galera_install_client | bool
|
||||||
- inventory_hostname not in galera_cluster_members or galera_root_user != 'root'
|
- inventory_hostname not in galera_cluster_members or galera_root_user != 'root'
|
||||||
@ -41,7 +41,7 @@
|
|||||||
- always
|
- always
|
||||||
|
|
||||||
- name: Including galera_devel_main
|
- name: Including galera_devel_main
|
||||||
include_tasks: galera_devel_main.yml
|
ansible.builtin.include_tasks: galera_devel_main.yml
|
||||||
when:
|
when:
|
||||||
- galera_install_devel | bool
|
- galera_install_devel | bool
|
||||||
args:
|
args:
|
||||||
@ -52,7 +52,7 @@
|
|||||||
- always
|
- always
|
||||||
|
|
||||||
- name: Including galera_server_main
|
- name: Including galera_server_main
|
||||||
include_tasks: galera_server_main.yml
|
ansible.builtin.include_tasks: galera_server_main.yml
|
||||||
when:
|
when:
|
||||||
- galera_install_server | bool
|
- galera_install_server | bool
|
||||||
args:
|
args:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user