--- - name: postgres | install | install postgres repo dnf: name: 'https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm' state: present disable_gpg_check: yes - name: postgres | install | disable postgresql module ansible.builtin.command: dnf -qy module disable postgresql register: postgresql_disable_repo args: creates: /etc/dnf/modules.d/postgresql.module - name: postgres | install | install postgresql dnf: name: - postgresql{{postgres_version}} - postgresql{{postgres_version}}-server state: present