From a83a130b1b2f251a36bde312d0e327a2c9211ce1 Mon Sep 17 00:00:00 2001 From: Roman Danko Date: Fri, 4 Oct 2024 14:51:12 +0200 Subject: [PATCH] Allow to upgrade packages when allowed by mariadb_upgrade (#226) * Allow to upgrade packages when allowed by mariadb_upgrade * Refactor mariadb package install for debian/redhat * Fix eof for tasks/mariadb_packages_install.yml --- tasks/debian.yml | 6 +----- tasks/mariadb_packages_install.yml | 7 +++++++ tasks/redhat.yml | 7 +------ 3 files changed, 9 insertions(+), 11 deletions(-) create mode 100644 tasks/mariadb_packages_install.yml diff --git a/tasks/debian.yml b/tasks/debian.yml index fdf7809..c43f591 100644 --- a/tasks/debian.yml +++ b/tasks/debian.yml @@ -58,8 +58,4 @@ become: true when: mariadb_config_overrides is defined -- name: debian | installing mariadb-galera packages - ansible.builtin.apt: - name: "{{ (galera_sst_method == 'mariabackup') | ternary( mariadb_packages | union( mariabackup_packages ), mariadb_packages ) }}" - state: "present" - become: true +- ansible.builtin.import_tasks: mariadb_packages_install.yml diff --git a/tasks/mariadb_packages_install.yml b/tasks/mariadb_packages_install.yml new file mode 100644 index 0000000..fece3a5 --- /dev/null +++ b/tasks/mariadb_packages_install.yml @@ -0,0 +1,7 @@ +--- +- name: mariadb_packages_install | installing mariadb-galera packages + ansible.builtin.package: + name: "{{ (galera_sst_method == 'mariabackup') | ternary( mariadb_packages | union( mariabackup_packages ), mariadb_packages ) }}" + state: "{{ mariadb_upgrade | ternary( 'latest', 'present' ) }}" + update_cache: true + become: true diff --git a/tasks/redhat.yml b/tasks/redhat.yml index 1eb4916..198e7bb 100644 --- a/tasks/redhat.yml +++ b/tasks/redhat.yml @@ -56,12 +56,7 @@ become: true when: mariadb_config_overrides is defined -- name: redhat | installing mariadb mysql - ansible.builtin.yum: - name: "{{ (galera_sst_method == 'mariabackup') | ternary( mariadb_packages | union( mariabackup_packages ), mariadb_packages ) }}" - state: "present" - update_cache: true - become: true +- ansible.builtin.import_tasks: mariadb_packages_install.yml - name: redhat | remove migrated-from-my.cnf-settings.conf that is causing MariaDB to not start ansible.builtin.file: