ansible-roles/percona/tasks/main.yml
Mathieu Trossevin 7c632352a0
Replace the include module with include_tasks or import_tasks
The behaviour of the `include` module is badly defined (it try to choose
between statically importing the tasks and dynamically including them)
and can cause problems depending on any number of constraints (mostly if
it choose the wrong behaviour).

Replace it with the `import_tasks` (always statically import tasks) unless
the `include` is in a loop in which case we replace it with
`include_tasks` (always dynamically include tasks).
2023-01-03 14:43:42 +01:00

66 lines
1.7 KiB
YAML

---
- set_fact:
percona__apt_config_package_file: "percona-release_latest.{{ ansible_distribution_release }}_all.deb"
- name: Look for legacy apt keyring
stat:
path: /etc/apt/trusted.gpg
register: _trusted_gpg_keyring
- name: Percona embedded GPG key is absent
apt_key:
id: "8507EFA5"
keyring: /etc/apt/trusted.gpg
state: absent
when: _trusted_gpg_keyring.stat.exists
- name: Add Percona GPG key
copy:
src: percona.asc
dest: "{{ apt_keyring_dir }}/percona.asc"
force: yes
mode: "0644"
owner: root
group: root
- name: Check if percona-release is installed
shell: "set -o pipefail && dpkg -l percona-release 2>/dev/null | grep -q -E '^(i|h)i'"
args:
executable: /bin/bash
check_mode: no
failed_when: False
changed_when: False
register: percona__apt_config_package_installed
- name: Percona APT config package is available
copy:
src: "{{ percona__apt_config_package_file }}"
dest: "/root/{{ percona__apt_config_package_file }}"
when: not (percona__apt_config_package_installed | bool)
# - include_role:
# name: evolix/remount-usr
- name: Percona APT config package is installed from deb file
apt:
deb: "/root/{{ percona__apt_config_package_file }}"
state: present
register: percona__apt_config_deb
when: not (percona__apt_config_package_installed | bool)
- name: Percona APT config package is installed from repository
apt:
name: percona-release
state: latest
register: percona__apt_config_deb
when: percona__apt_config_package_installed | bool
- name: APT cache is up-to-date
apt:
update_cache: yes
when: percona__apt_config_deb is changed
- import_tasks: xtrabackup.yml
when: percona__install_xtrabackup | bool