patroni/tasks/RedHat/patroni_install.yaml
2023-03-29 23:49:37 +03:00

40 lines
1.1 KiB
YAML

- name: Gather packages
package_facts:
manager: auto
- name: Set fact about Patroni package
set_fact:
patroni_installed_package: "{{ ansible_facts.packages[patroni_package_name][0]['name'] }}"
when: patroni_package_name in ansible_facts.packages
- name: Print installed Patroni version
debug:
msg: "{{ ansible_facts.packages[patroni_package_name][0]['version'] }}"
verbosity: 2
when: patroni_installed_package is defined
- name: "Install {{ patroni_package_name }}-{{ patroni_version }}"
dnf:
name: "{{ item }}"
state: present
disable_gpg_check: yes
update_cache: yes
loop:
- "{{ patroni_default_packages }}"
register: patroni_setup
when: patroni_package_name not in ansible_facts.packages
- name: "Update {{ patroni_package_name }}-{{ patroni_version }}"
dnf:
name: "{{ item }}"
state: present
disable_gpg_check: yes
update_cache: yes
loop:
- "{{ patroni_default_packages }}"
register: patroni_update
notify: Restart Patroni
when:
- patroni_package_name in ansible_facts.packages
- ansible_facts.packages[patroni_package_name][0]['version'] != patroni_version|string