Target server:
-bash-4.2$ python -V
Python 2.7.5
-bash-4.2$ pip list | grep psycopg2
psycopg2 (2.8.3)
But if run ansible playbook with this task will fail:
- name: Create repmgr database
postgresql_db:
name: repmgr
become: true
become_user: postgres
Error:
TASK [db : Create repmgr database] ***************************************************************************
fatal: [192.168.0.1]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (psycopg2) on db's Python /usr/bin/python. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}
Why can't it import psycopg2
?