Use module_hotfixes for yum_repository

Since ansible-core 2.11 it's possible to use module_hotfixes argument of
yum_repository instead of standalone task. This improves role
idempotency and simplifies logic.

Change-Id: I65a79d82816665dc903c259eab11c8f02361e51d
This commit is contained in:
Dmitriy Rabotyagov 2025-01-22 14:48:04 +01:00
parent 25eba0bab6
commit e31cc13254

@ -103,6 +103,7 @@
gpgkey: "{{ galera_repo.gpgkey | default(omit) }}"
gpgcheck: yes
enabled: yes
module_hotfixes: true
priority: 25
state: "{{ galera_repo.state | default(omit) }}"
register: add_galera_repos
@ -110,26 +111,6 @@
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"
when:
- galera_install_method == 'external_repo'
# 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.
- name: Force the expiry of the repo metadata
command: "{{ ansible_facts['pkg_mgr'] }} clean metadata"
when: add_galera_repos is changed
tags:
- skip_ansible_lint
- name: Install galera role remote packages
package:
name: "{{ galera_packages_list }}"