- name: Ensure Python 3.9 and psycopg2 installed dnf: name: - python39 - python39-psycopg2 state: present - name: Set initial PostgreSQL user become: true become_user: postgres vars: ansible_python_interpreter: '/usr/bin/env python3' community.postgresql.postgresql_user: db: "postgres" name: "postgres" password: "{{ postgresql_superuser_password }}" state: present