Improve handling of galera_install_method changing
Instead of using a conditional block, use the "state" parameter of the yum_repository module to ensure that the repo config is correctly added/removed if galera_install_method is changed after initial deployment. Change-Id: I442e44a2d414896799d8223d8fe6c120894fc67c
This commit is contained in:
parent
e01b9194b4
commit
c10ce105e6
@ -86,38 +86,38 @@
|
||||
state: "link"
|
||||
force: true
|
||||
|
||||
- name: Configure repositories for MariaDB installation
|
||||
- name: If a keyfile is provided, copy the gpg keyfile to the key location
|
||||
copy:
|
||||
src: "gpg/{{ item.key | basename }}"
|
||||
dest: "{{ item.key }}"
|
||||
mode: '0644'
|
||||
with_items: "{{ galera_gpg_keys }}"
|
||||
when:
|
||||
- galera_install_method == 'external_repo'
|
||||
- galera_repo
|
||||
block:
|
||||
- name: If a keyfile is provided, copy the gpg keyfile to the key location
|
||||
copy:
|
||||
src: "gpg/{{ item.key | basename }}"
|
||||
dest: "{{ item.key }}"
|
||||
mode: '0644'
|
||||
with_items: "{{ galera_gpg_keys }}"
|
||||
|
||||
- name: Add galera repo
|
||||
yum_repository:
|
||||
name: "{{ galera_repo.name }}"
|
||||
description: "{{ galera_repo.description }}"
|
||||
baseurl: "{{ galera_repo.baseurl }}"
|
||||
gpgkey: "{{ galera_repo.gpgkey | default(omit) }}"
|
||||
gpgcheck: yes
|
||||
enabled: yes
|
||||
priority: 25
|
||||
register: add_galera_repos
|
||||
until: add_galera_repos is success
|
||||
retries: 5
|
||||
delay: 2
|
||||
- name: Add galera repo
|
||||
yum_repository:
|
||||
name: "{{ galera_repo.name }}"
|
||||
description: "{{ galera_repo.description }}"
|
||||
baseurl: "{{ galera_repo.baseurl }}"
|
||||
gpgkey: "{{ galera_repo.gpgkey | default(omit) }}"
|
||||
gpgcheck: yes
|
||||
enabled: yes
|
||||
priority: 25
|
||||
state: "{{ galera_repo.state | default(omit) }}"
|
||||
register: add_galera_repos
|
||||
until: add_galera_repos is success
|
||||
retries: 5
|
||||
delay: 2
|
||||
|
||||
- name: Enable module_hotfixes
|
||||
lineinfile:
|
||||
dest: "/etc/yum.repos.d/{{ galera_repo.name }}.repo"
|
||||
line: "module_hotfixes=1"
|
||||
regexp: "^module_hotfixes"
|
||||
insertafter: "^enabled"
|
||||
- name: Enable module_hotfixes
|
||||
lineinfile:
|
||||
dest: "/etc/yum.repos.d/{{ galera_repo.name }}.repo"
|
||||
line: "module_hotfixes=1"
|
||||
regexp: "^module_hotfixes"
|
||||
insertafter: "^enabled"
|
||||
when:
|
||||
- galera_install_method == 'external_repo'
|
||||
|
||||
# When changing the repo URL, the metadata does
|
||||
# not reliably update, resulting in the right
|
||||
|
@ -67,6 +67,7 @@ _galera_repo:
|
||||
description: "MariaDB Repo"
|
||||
baseurl: "{{ galera_repo_url }}"
|
||||
gpgkey: "file://{{ galera_gpg_keys | map(attribute='key') | join('file://') }}"
|
||||
state: "{{ (galera_install_method == 'external_repo') | ternary('present', 'absent') }}"
|
||||
|
||||
# NOTE: CentOS Stream/Rocky 9 still ship mariadb 10.5 out of their default repos
|
||||
galera_wsrep_provider: "/usr/lib64/{{ (galera_install_method == 'external_repo') | ternary('galera-4', 'galera') }}/libgalera_smm.so"
|
||||
|
Loading…
x
Reference in New Issue
Block a user