Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMM-12998 Log message on ansible self update. #2925

Merged
merged 8 commits into from
Apr 5, 2024
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
Loading