From abeacee6f6d5301edd9e88454ffb6837fae19e80 Mon Sep 17 00:00:00 2001 From: Talha Bin Rizwan Date: Fri, 5 Apr 2024 23:05:37 +0500 Subject: [PATCH] PMM-12998 Log message on ansible self update. (#2925) * PMM-12998 Log message on ansible self update. * Update update/ansible/playbook/tasks/update.yml --------- Co-authored-by: Alex Demidoff --- update/ansible/playbook/tasks/update.yml | 58 +++++++++++++++--------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/update/ansible/playbook/tasks/update.yml b/update/ansible/playbook/tasks/update.yml index ff6632a6ad..be8f18e4bb 100644 --- a/update/ansible/playbook/tasks/update.yml +++ b/update/ansible/playbook/tasks/update.yml @@ -22,6 +22,43 @@ - vmproxy - grafana-db-migrator pre_tasks: + - name: Check for updates of ansible-core package | EL9 + shell: yum list updates ansible-core | grep -q 'ansible-core' && echo 'Available' || echo 'Not Available' + register: ansible_core_update + when: + - ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux' + - ansible_distribution_major_version == '9' + + - name: Log message if ansible-core package needs update | EL9 + debug: + msg: "The ansible-core package needs update. Playbook will re-run to apply the changes." + when: + - ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux' + - ansible_distribution_major_version == '9' + - ansible_core_update.stdout == "Available" + + - name: Remove ansible RPM if installed | EL9 + when: + - ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux' + - ansible_distribution_major_version == '9' + yum: + name: ansible + state: absent + ignore_errors: yes + + - name: Install ansible-core RPM | EL9 + when: + - ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux' + - ansible_distribution_major_version == '9' + - not ansible_check_mode + yum: + name: + - ansible-core + - ansible-collection-community-general + - ansible-collection-community-postgresql + - ansible-collection-ansible-posix + state: latest + - name: detect /srv/pmm-distribution stat: path: /srv/pmm-distribution @@ -271,27 +308,6 @@ - sshpass - vi - - name: Remove ansible RPM if installed | EL9 - when: - - ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux' - - ansible_distribution_major_version == '9' - yum: - name: ansible - state: absent - ignore_errors: yes - - - name: Install ansible-core RPM | EL9 - when: - - ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux' - - ansible_distribution_major_version == '9' - yum: - name: - - ansible-core - - ansible-collection-community-general - - ansible-collection-community-postgresql - - ansible-collection-ansible-posix - state: present - - name: Update system packages EL9 when: - ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux'