generated from ansible-collections/collection_template
-
Notifications
You must be signed in to change notification settings - Fork 112
Closed
Description
SUMMARY
When using the community.postgresql.postgresql_user or community.postgresql.postgresql_schema ansible modules, I am facing a python stacktrace which has the error "AttributeError: 'NoneType' object has no attribute 'version'".
I have looked online and seen that this could be due to 'psycopg2' being missing but I have added an ansible step to ensure this is present.
Any help greatly appreciated.
ISSUE TYPE
- Bug Report
COMPONENT NAME
community.postgresql.postgresql_user
community.postgresql.postgresql_schema
ANSIBLE VERSION
ansible [core 2.12.4]
config file = None
configured module search path = ['/Users/olliecole/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /opt/homebrew/lib/python3.9/site-packages/ansible
ansible collection location = /Users/olliecole/.ansible/collections:/usr/share/ansible/collections
executable location = /opt/homebrew/bin/ansible
python version = 3.9.12 (main, Mar 26 2022, 15:44:31) [Clang 13.1.6 (clang-1316.0.21.2)]
jinja version = 3.1.1
libyaml = True
COLLECTION VERSION
# /Users/olliecole/.ansible/collections/ansible_collections
Collection Version
-------------------- -------
community.postgresql 2.1.3
# /opt/homebrew/lib/python3.9/site-packages/ansible_collections
Collection Version
-------------------- -------
community.postgresql 1.7.1
CONFIGURATION
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
(END)
OS / ENVIRONMENT
MacOS 12.3.1
Database is on AWS RDS Postgres.
STEPS TO REPRODUCE
---
- name: Create ansible_tooling user, set password, grant privs
community.postgresql.postgresql_user:
login_host: "{{ cloud_database_postgresql_fqdn }}"
port: "{{ tooling_ansible_database_postgresql_port }}"
login_user: "{{ cloud_database_postgresql_master_username }}"
login_password: "{{ cloud_database_postgresql_master_password }}"
name: "{{ tooling_ansible_database_postgresql_username }}"
password: "{{ tf_tooling_ansible.outputs.tooling_ansible_database_postgresql_password }}"
role_attr_flags: "{{ tooling_ansible_database_postgresql_role_attr_flags }}"
EXPECTED RESULTS
Playbook should run and configure users.
ACTUAL RESULTS
The full traceback is:
Traceback (most recent call last):
File "/Users/olliecole/.ansible/tmp/ansible-tmp-1651226309.226697-22461-187613661793656/AnsiballZ_postgresql_user.py", line 107, in <module>
_ansiballz_main()
File "/Users/olliecole/.ansible/tmp/ansible-tmp-1651226309.226697-22461-187613661793656/AnsiballZ_postgresql_user.py", line 99, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/Users/olliecole/.ansible/tmp/ansible-tmp-1651226309.226697-22461-187613661793656/AnsiballZ_postgresql_user.py", line 47, in invoke_module
runpy.run_module(mod_name='ansible_collections.community.postgresql.plugins.modules.postgresql_user', init_globals=dict(_module_fqn='ansible_collections.community.postgresql.plugins.modules.postgresql_user', _modlib_path=modlib_path),
File "/opt/homebrew/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 210, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/opt/homebrew/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/opt/homebrew/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/var/folders/dr/2fw5_ncd7hn_x18fyfcnvq700000gn/T/ansible_community.postgresql.postgresql_user_payload_hsbp_1tn/ansible_community.postgresql.postgresql_user_payload.zip/ansible_collections/community/postgresql/plugins/modules/postgresql_user.py", line 1038, in <module>
File "/var/folders/dr/2fw5_ncd7hn_x18fyfcnvq700000gn/T/ansible_community.postgresql.postgresql_user_payload_hsbp_1tn/ansible_community.postgresql.postgresql_user_payload.zip/ansible_collections/community/postgresql/plugins/modules/postgresql_user.py", line 954, in main
File "/var/folders/dr/2fw5_ncd7hn_x18fyfcnvq700000gn/T/ansible_community.postgresql.postgresql_user_payload_hsbp_1tn/ansible_community.postgresql.postgresql_user_payload.zip/ansible_collections/community/postgresql/plugins/module_utils/postgres.py", line 192, in get_conn_params
AttributeError: 'NoneType' object has no attribute '__version__'
fatal: [localhost]: FAILED! => {
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File \"/Users/olliecole/.ansible/tmp/ansible-tmp-1651226309.226697-22461-187613661793656/AnsiballZ_postgresql_user.py\", line 107, in <module>\n _ansiballz_main()\n File \"/Users/olliecole/.ansible/tmp/ansible-tmp-1651226309.226697-22461-187613661793656/AnsiballZ_postgresql_user.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/Users/olliecole/.ansible/tmp/ansible-tmp-1651226309.226697-22461-187613661793656/AnsiballZ_postgresql_user.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.community.postgresql.plugins.modules.postgresql_user', init_globals=dict(_module_fqn='ansible_collections.community.postgresql.plugins.modules.postgresql_user', _modlib_path=modlib_path),\n File \"/opt/homebrew/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py\", line 210, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/opt/homebrew/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/opt/homebrew/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/var/folders/dr/2fw5_ncd7hn_x18fyfcnvq700000gn/T/ansible_community.postgresql.postgresql_user_payload_hsbp_1tn/ansible_community.postgresql.postgresql_user_payload.zip/ansible_collections/community/postgresql/plugins/modules/postgresql_user.py\", line 1038, in <module>\n File \"/var/folders/dr/2fw5_ncd7hn_x18fyfcnvq700000gn/T/ansible_community.postgresql.postgresql_user_payload_hsbp_1tn/ansible_community.postgresql.postgresql_user_payload.zip/ansible_collections/community/postgresql/plugins/modules/postgresql_user.py\", line 954, in main\n File \"/var/folders/dr/2fw5_ncd7hn_x18fyfcnvq700000gn/T/ansible_community.postgresql.postgresql_user_payload_hsbp_1tn/ansible_community.postgresql.postgresql_user_payload.zip/ansible_collections/community/postgresql/plugins/module_utils/postgres.py\", line 192, in get_conn_params\nAttributeError: 'NoneType' object has no attribute '__version__'\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels