mirror of
https://gitea.0xace.cc/ansible-galaxy/patroni.git
synced 2024-11-25 08:06:39 +00:00
40 lines
1.1 KiB
YAML
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
|