Skip to content

Commit

Permalink
PMM-12998 Log message on ansible self update. (#2925)
Browse files Browse the repository at this point in the history
* PMM-12998 Log message on ansible self update.

* Update update/ansible/playbook/tasks/update.yml

---------

Co-authored-by: Alex Demidoff <[email protected]>
  • Loading branch information
talhabinrizwan and ademidoff authored Apr 5, 2024
1 parent b6c7d89 commit abeacee
Showing 1 changed file with 37 additions and 21 deletions.
58 changes: 37 additions & 21 deletions update/ansible/playbook/tasks/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit abeacee

Please sign in to comment.