patroni/tasks/Debian/patroni_install.yaml

44 lines
1.5 KiB
YAML
Raw Normal View History

2023-03-29 20:49:37 +00:00
- name: Gather packages
package_facts:
manager: auto
2023-04-16 00:28:23 +00:00
- name: Install deps packages
apt:
name: "{{ patroni_deps_packages }}"
state: present
update_cache: yes
2023-03-29 20:49:37 +00:00
- 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: Mask Patroni before install
ansible.builtin.systemd:
name: "{{ patroni_unit_name }}"
masked: yes
when: patroni_package_name not in ansible_facts.packages or ansible_facts.packages[patroni_package_name][0]['version'] != (patroni_version|string + "-" + patroni_version_build|string)
- name: "Install {{ patroni_package_name }}-{{ patroni_version }}-{{ patroni_version_build }}"
apt:
name: "{{ patroni_package }}"
update_cache: yes
register: patroni_setup
when: patroni_package_name not in ansible_facts.packages
- name: "Update {{ patroni_package_name }}-{{ patroni_version }}-{{ patroni_version_build }}"
apt:
name: "{{ patroni_package }}"
update_cache: yes
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 + "-" + patroni_version_build|string)