- name: Gather packages package_facts: manager: auto - name: Install deps packages dnf: name: "{{ patroni_deps_packages }}" state: present update_cache: yes - 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