postgresql_info fails

Hello I am trying to get this working,but getting following error. is it from ansible or moudle?

Hello I am trying to get this working,but getting following error. is it from ansible or moudle?

Good question, but try to tell Ansible to use Python 3 on the target:

ansible_python_interpreter: /usr/bin/python3

Regards
          Racke

Thank you for fast reply

Passed the var from comman line

ansible-playbook postgres.yml -e ‘ansible_python_interpreter=/usr/bin/python3’ -vvv

Error Output:

fatal: [staging]: FAILED! => {
“ansible_facts”: {},
“changed”: false,
“failed_modules”: {
“setup”: {
“exception”: “Traceback (most recent call last):\r\n File "/root/.ansible/tmp/ansible-tmp-1584540952.95-42346186184755/AnsiballZ_setup.py", line 102, in \r\n _ansiballz_main()\r\n File "/root/.ansible/tmp/ansible-tmp-1584540952.95-42346186184755/AnsiballZ_setup.py", line 94, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File "/root/.ansible/tmp/ansible-tmp-1584540952.95-42346186184755/AnsiballZ_setup.py", line 40, in invoke_module\r\n runpy.run_module(mod_name=‘ansible.modules.setup’, init_globals=None, run_name=‘main’, alter_sys=True)\r\n File "/usr/lib/python3.5/runpy.py", line 196, in run_module\r\n return _run_module_code(code, init_globals, run_name, mod_spec)\r\n File "/usr/lib/python3.5/runpy.py", line 96, in _run_module_code\r\n mod_name, mod_spec, pkg_name, script_name)\r\n File "/usr/lib/python3.5/runpy.py", line 85, in _run_code\r\n exec(code, run_globals)\r\n File "/tmp/ansible_setup_payload_kteaw1zg/ansible_setup_payload.zip/ansible/modules/setup.py", line 136, in \r\nValueError: attempted relative import beyond top-level package\r\n”,
“failed”: true,
“module_stderr”: “Shared connection to 138.548.458.6 closed.\r\n”,
“module_stdout”: “Traceback (most recent call last):\r\n File "/root/.ansible/tmp/ansible-tmp-1584540952.95-42346186184755/AnsiballZ_setup.py", line 102, in \r\n _ansiballz_main()\r\n File "/root/.ansible/tmp/ansible-tmp-1584540952.95-42346186184755/AnsiballZ_setup.py", line 94, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File "/root/.ansible/tmp/ansible-tmp-1584540952.95-42346186184755/AnsiballZ_setup.py", line 40, in invoke_module\r\n runpy.run_module(mod_name=‘ansible.modules.setup’, init_globals=None, run_name=‘main’, alter_sys=True)\r\n File "/usr/lib/python3.5/runpy.py", line 196, in run_module\r\n return _run_module_code(code, init_globals, run_name, mod_spec)\r\n File "/usr/lib/python3.5/runpy.py", line 96, in _run_module_code\r\n mod_name, mod_spec, pkg_name, script_name)\r\n File "/usr/lib/python3.5/runpy.py", line 85, in _run_code\r\n exec(code, run_globals)\r\n File "/tmp/ansible_setup_payload_kteaw1zg/ansible_setup_payload.zip/ansible/modules/setup.py", line 136, in \r\nValueError: attempted relative import beyond top-level package\r\n”,
“msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”,
“rc”: 1
}
},
“msg”: “The following modules failed to execute: setup\n”
}

PLAY RECAP ***********************************************************************************************************************************************************************************
support-staging : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

Can you try adding this to the playbook:

gather_facts: false

Great. Thank you. hat helped to resolve the issue.

Right.... your issue with THIS task may be solved, but there is still
ANOTHER problem on your target host that prevents the setup module
from running.
You should address that because it will come back and bite you later....

Yes, I had to install the following on the servers.

python3-pip libpq-dev python-pip
pip3 install psycopg2
pip install psycopg2