Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postgresql_query, Postgresql 13, select from pg_stat_statements -> MODULE FAILURE #1676

Closed
IgorOhrimenko opened this issue Jan 25, 2021 · 2 comments
Labels
bug This issue/PR relates to a bug needs_triage python3 traceback

Comments

@IgorOhrimenko
Copy link

SUMMARY

postgresql_query MODULE FAILURE when SELECT * FROM pg_stat_statements LIMIT 1

ISSUE TYPE
  • Bug Report
COMPONENT NAME

postgresql_query

ANSIBLE VERSION
ansible 2.9.6
  config file = /home/igor/ansible-playbooks/ansible.cfg
  configured module search path = ['/home/igor/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0]

CONFIGURATION
DEFAULT_GATHER_TIMEOUT(/home/igor/ansible-playbooks/ansible.cfg) = 20
DEFAULT_LOAD_CALLBACK_PLUGINS(/home/igor/ansible-playbooks/ansible.cfg) = True
DEFAULT_LOG_PATH(/home/igor/ansible-playbooks/ansible.cfg) = /tmp/ansible.log
DEFAULT_STDOUT_CALLBACK(/home/igor/ansible-playbooks/ansible.cfg) = debug
DEPRECATION_WARNINGS(/home/igor/ansible-playbooks/ansible.cfg) = False
HOST_KEY_CHECKING(/home/igor/ansible-playbooks/ansible.cfg) = False
INTERPRETER_PYTHON(/home/igor/ansible-playbooks/ansible.cfg) = auto_silent
OS / ENVIRONMENT

PostgreSQL 13

STEPS TO REPRODUCE

docker run -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres -c shared_preload_libraries='pg_stat_statements'
docker exec postgres psql -U postgres -c 'CREATE EXTENSION IF NOT EXISTS pg_stat_statements'
ansible-playbook -i 'localhost,' pg-test.yaml -v

---
- hosts: localhost
  tasks:
    - name: Select query to db acme with positional arguments and non-default credentials
      community.general.postgresql_query:
        login_host: localhost
        db: postgres
        login_user: postgres
        login_password: mysecretpassword
        query: SELECT * FROM pg_stat_statements LIMIT 1
EXPECTED RESULTS
"statusmessage": "SELECT 1"
ACTUAL RESULTS
TASK [Select query to db acme with positional arguments and non-default credentials] ****************************************************************************************************************************
task path: /home/igor/ansible-playbooks/pg-test.yaml:4
<localhost> ESTABLISH SSH CONNECTION FOR USER: None
<localhost> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/igor/.ansible/cp/8a5a4c6a60 localhost '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
<localhost> (0, b'/home/igor\n', b'')
<localhost> ESTABLISH SSH CONNECTION FOR USER: None
<localhost> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/igor/.ansible/cp/8a5a4c6a60 localhost '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/igor/.ansible/tmp/ansible-tmp-1611578946.6924086-263976548695497 `" && echo ansible-tmp-1611578946.6924086-263976548695497="` echo /home/igor/.ansible/tmp/ansible-tmp-1611578946.6924086-263976548695497 `" ) && sleep 0'"'"''
<localhost> (0, b'ansible-tmp-1611578946.6924086-263976548695497=/home/igor/.ansible/tmp/ansible-tmp-1611578946.6924086-263976548695497\n', b'')
Using module file /home/igor/.ansible/collections/ansible_collections/community/general/plugins/modules/postgresql_query.py
<localhost> PUT /home/igor/.ansible/tmp/ansible-local-2725208vzi5rarc/tmp0qqko1c1 TO /home/igor/.ansible/tmp/ansible-tmp-1611578946.6924086-263976548695497/AnsiballZ_postgresql_query.py
<localhost> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/igor/.ansible/cp/8a5a4c6a60 '[localhost]'
<localhost> (0, b'sftp> put /home/igor/.ansible/tmp/ansible-local-2725208vzi5rarc/tmp0qqko1c1 /home/igor/.ansible/tmp/ansible-tmp-1611578946.6924086-263976548695497/AnsiballZ_postgresql_query.py\n', b'')
<localhost> ESTABLISH SSH CONNECTION FOR USER: None
<localhost> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/igor/.ansible/cp/8a5a4c6a60 localhost '/bin/sh -c '"'"'chmod u+x /home/igor/.ansible/tmp/ansible-tmp-1611578946.6924086-263976548695497/ /home/igor/.ansible/tmp/ansible-tmp-1611578946.6924086-263976548695497/AnsiballZ_postgresql_query.py && sleep 0'"'"''
<localhost> (0, b'', b'')
<localhost> ESTABLISH SSH CONNECTION FOR USER: None
<localhost> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/igor/.ansible/cp/8a5a4c6a60 -tt localhost '/bin/sh -c '"'"'/usr/bin/python3 /home/igor/.ansible/tmp/ansible-tmp-1611578946.6924086-263976548695497/AnsiballZ_postgresql_query.py && sleep 0'"'"''
<localhost> (1, b'Traceback (most recent call last):\r\n  File "/home/igor/.ansible/tmp/ansible-tmp-1611578946.6924086-263976548695497/AnsiballZ_postgresql_query.py", line 102, in <module>\r\n    _ansiballz_main()\r\n  File "/home/igor/.ansible/tmp/ansible-tmp-1611578946.6924086-263976548695497/AnsiballZ_postgresql_query.py", line 94, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File "/home/igor/.ansible/tmp/ansible-tmp-1611578946.6924086-263976548695497/AnsiballZ_postgresql_query.py", line 40, in invoke_module\r\n    runpy.run_module(mod_name=\'ansible_collections.community.general.plugins.modules.postgresql_query\', init_globals=None, run_name=\'__main__\', alter_sys=True)\r\n  File "/usr/lib/python3.8/runpy.py", line 207, in run_module\r\n    return _run_module_code(code, init_globals, run_name, mod_spec)\r\n  File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code\r\n    _run_code(code, mod_globals, init_globals,\r\n  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code\r\n    exec(code, run_globals)\r\n  File "/tmp/ansible_community.general.postgresql_query_payload_w1g2qy8k/ansible_community.general.postgresql_query_payload.zip/ansible_collections/community/general/plugins/modules/postgresql_query.py", line 452, in <module>\r\n  File "/tmp/ansible_community.general.postgresql_query_payload_w1g2qy8k/ansible_community.general.postgresql_query_payload.zip/ansible_collections/community/general/plugins/modules/postgresql_query.py", line 448, in main\r\n  File "/tmp/ansible_community.general.postgresql_query_payload_w1g2qy8k/ansible_community.general.postgresql_query_payload.zip/ansible/module_utils/basic.py", line 2071, in exit_json\r\n  File "/tmp/ansible_community.general.postgresql_query_payload_w1g2qy8k/ansible_community.general.postgresql_query_payload.zip/ansible/module_utils/basic.py", line 2064, in _return_formatted\r\n  File "/tmp/ansible_community.general.postgresql_query_payload_w1g2qy8k/ansible_community.general.postgresql_query_payload.zip/ansible/module_utils/basic.py", line 418, in remove_values\r\n  File "/tmp/ansible_community.general.postgresql_query_payload_w1g2qy8k/ansible_community.general.postgresql_query_payload.zip/ansible/module_utils/basic.py", line 401, in _remove_values_conditions\r\nTypeError: Value of unknown type: <class \'decimal.Decimal\'>, 0\r\n', b'Shared connection to localhost closed.\r\n')
<localhost> Failed to connect to the host via ssh: Shared connection to localhost closed.
<localhost> ESTABLISH SSH CONNECTION FOR USER: None
<localhost> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/igor/.ansible/cp/8a5a4c6a60 localhost '/bin/sh -c '"'"'rm -f -r /home/igor/.ansible/tmp/ansible-tmp-1611578946.6924086-263976548695497/ > /dev/null 2>&1 && sleep 0'"'"''
<localhost> (0, b'', b'')
The full traceback is:
Traceback (most recent call last):
  File "/home/igor/.ansible/tmp/ansible-tmp-1611578946.6924086-263976548695497/AnsiballZ_postgresql_query.py", line 102, in <module>
    _ansiballz_main()
  File "/home/igor/.ansible/tmp/ansible-tmp-1611578946.6924086-263976548695497/AnsiballZ_postgresql_query.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/igor/.ansible/tmp/ansible-tmp-1611578946.6924086-263976548695497/AnsiballZ_postgresql_query.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.community.general.plugins.modules.postgresql_query', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib/python3.8/runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_community.general.postgresql_query_payload_w1g2qy8k/ansible_community.general.postgresql_query_payload.zip/ansible_collections/community/general/plugins/modules/postgresql_query.py", line 452, in <module>
  File "/tmp/ansible_community.general.postgresql_query_payload_w1g2qy8k/ansible_community.general.postgresql_query_payload.zip/ansible_collections/community/general/plugins/modules/postgresql_query.py", line 448, in main
  File "/tmp/ansible_community.general.postgresql_query_payload_w1g2qy8k/ansible_community.general.postgresql_query_payload.zip/ansible/module_utils/basic.py", line 2071, in exit_json
  File "/tmp/ansible_community.general.postgresql_query_payload_w1g2qy8k/ansible_community.general.postgresql_query_payload.zip/ansible/module_utils/basic.py", line 2064, in _return_formatted
  File "/tmp/ansible_community.general.postgresql_query_payload_w1g2qy8k/ansible_community.general.postgresql_query_payload.zip/ansible/module_utils/basic.py", line 418, in remove_values
  File "/tmp/ansible_community.general.postgresql_query_payload_w1g2qy8k/ansible_community.general.postgresql_query_payload.zip/ansible/module_utils/basic.py", line 401, in _remove_values_conditions
TypeError: Value of unknown type: <class 'decimal.Decimal'>, 0
fatal: [localhost]: FAILED! => {
    "changed": false,
    "rc": 1
}

MSG:

MODULE FAILURE
See stdout/stderr for the exact error

MODULE_STDOUT:

Traceback (most recent call last):
  File "/home/igor/.ansible/tmp/ansible-tmp-1611578946.6924086-263976548695497/AnsiballZ_postgresql_query.py", line 102, in <module>
    _ansiballz_main()
  File "/home/igor/.ansible/tmp/ansible-tmp-1611578946.6924086-263976548695497/AnsiballZ_postgresql_query.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/igor/.ansible/tmp/ansible-tmp-1611578946.6924086-263976548695497/AnsiballZ_postgresql_query.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.community.general.plugins.modules.postgresql_query', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib/python3.8/runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_community.general.postgresql_query_payload_w1g2qy8k/ansible_community.general.postgresql_query_payload.zip/ansible_collections/community/general/plugins/modules/postgresql_query.py", line 452, in <module>
  File "/tmp/ansible_community.general.postgresql_query_payload_w1g2qy8k/ansible_community.general.postgresql_query_payload.zip/ansible_collections/community/general/plugins/modules/postgresql_query.py", line 448, in main
  File "/tmp/ansible_community.general.postgresql_query_payload_w1g2qy8k/ansible_community.general.postgresql_query_payload.zip/ansible/module_utils/basic.py", line 2071, in exit_json
  File "/tmp/ansible_community.general.postgresql_query_payload_w1g2qy8k/ansible_community.general.postgresql_query_payload.zip/ansible/module_utils/basic.py", line 2064, in _return_formatted
  File "/tmp/ansible_community.general.postgresql_query_payload_w1g2qy8k/ansible_community.general.postgresql_query_payload.zip/ansible/module_utils/basic.py", line 418, in remove_values
  File "/tmp/ansible_community.general.postgresql_query_payload_w1g2qy8k/ansible_community.general.postgresql_query_payload.zip/ansible/module_utils/basic.py", line 401, in _remove_values_conditions
TypeError: Value of unknown type: <class 'decimal.Decimal'>, 0

MODULE_STDERR:

Shared connection to localhost closed.
@ansibullbot
Copy link
Collaborator

Files identified in the description:
None

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@Akasurde
Copy link
Member

Thank you very much for your interest in Ansible. This plugin/module is no longer maintained in this repository and has been migrated to https://github.com/ansible-collections/community.postgresql

Migrated this issue in the above repository - ansible-collections/community.postgresql#45.

If you have further questions please stop by IRC or the mailing list:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug needs_triage python3 traceback
Projects
None yet
Development

No branches or pull requests

3 participants