Hi ansible version: 2.6.7 python version: 3.8.10 OS: Ubuntu 20
I want to add postgres user with ansible. So I installed required package, psycopg2(python3-psycopg2) - name: Add role of postgres become_user: postgres postgresql_user: name: postgres role_attr_flags: NOREPLICATION but Ansible said "the python psycopg2 module is required" python-psycopg2 package does not exist in focal repository. How can I make ansible use python3-psycopg2? TASK [postgresql-server : Add role of postgres]********************************************************* task path: /root/setup/ansible-gerrit/roles/postgresql-server/tasks/db.yml:2 Tuesday 11 April 2023 17:49:29 +0900 (0:00:02.337) 0:00:23.739 ********* <localhost> ESTABLISH LOCAL CONNECTION FOR USER: root <localhost> EXEC /bin/sh -c 'echo ~root && sleep 0' <localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /var/tmp/ansible-tmp-1681202969.7012537-234639475555220 `" && echo ansible-tmp-1681202969.7012537-234639475555220="` echo /var/tmp/ansible-tmp-1681202969.7012537-234639475555220 `" ) && sleep 0' Using module file /usr/local/lib/python3.8/dist-packages/ansible/modules/database/postgresql/postgresql_user.py <localhost> PUT /root/.ansible/tmp/ansible-local-48574fgls2za0/tmp8hw5m95b TO /var/tmp/ansible-tmp-1681202969.7012537-234639475555220/postgresql_user.py <localhost> EXEC /bin/sh -c 'setfacl -m u:postgres:r-x /var/tmp/ansible-tmp-1681202969.7012537-234639475555220/ /var/tmp/ansible-tmp-1681202969.7012537-234639475555220/postgresql_user.py && sleep 0' <localhost> EXEC /bin/sh -c 'chmod u+x /var/tmp/ansible-tmp-1681202969.7012537-234639475555220/ /var/tmp/ansible-tmp-1681202969.7012537-234639475555220/postgresql_user.py && sleep 0' <localhost> EXEC /bin/sh -c 'chown postgres /var/tmp/ansible-tmp-1681202969.7012537-234639475555220/ /var/tmp/ansible-tmp-1681202969.7012537-234639475555220/postgresql_user.py && sleep 0' <localhost> EXEC /bin/sh -c 'sudo -H -S -n -u postgres /bin/sh -c '"'"'echo BECOME-SUCCESS-egfgzvnxohnublyrrsosdxbthsgsxbqb; /usr/bin/python /var/tmp/ansible-tmp-1681202969.7012537-234639475555220/postgresql_user.py'"'"' && sleep 0' <localhost> EXEC /bin/sh -c 'rm -f -r /var/tmp/ansible-tmp-1681202969.7012537-234639475555220/ > /dev/null 2>&1 && sleep 0' The full traceback is: File "/tmp/ansible_TYsT7h/ansible_module_postgresql_user.py", line 210, in <module> import psycopg2 fatal: [localhost]: FAILED! => { "changed": false, "invocation": { "module_args": { "conn_limit": null, "db": "", "encrypted": true, "expires": null, "fail_on_user": true, "login_host": "", "login_password": "", "login_unix_socket": "", "login_user": "postgres", "name": "postgres", "no_password_changes": false, "password": null, "port": "5432", "priv": null, "role_attr_flags": "NOREPLICATION", "ssl_mode": "prefer", "ssl_rootcert": null, "state": "present", "user": "postgres" } }, "msg": "the python psycopg2 module is required" } -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/b3d0ff14-5c2c-43a7-b7f6-221b1aba7ea0n%40googlegroups.com.