roles:
- role: ansible-role-postgresql
become: yes
postgresql_enablerepo: "pgdg96"
postgresql_restarted_state: "restarted"
postgresql_python_library: python-psycopg2
postgresql_bin_path: /usr/pgsql-9.6/bin
postgresql_daemon: postgresql-9.6.service
TASK [ansible-role-postgresql : Ensure PostgreSQL databases are present.] ****************************************************************************
failed: [clpaxd-iwh01.na.ad.rrd.com] (item={u'owner': u'manifold', u'login_user': u'manifold', u'name': u'manifoldcf', u'login_password': u'manifold'}) => {"changed": false, "item": {"login_password": "manifold", "login_user": "manifold", "name": "manifoldcf", "owner": "manifold"}, "msg": "the python psycopg2 module is required"}
环境:
知道如何解决这个问题吗?
试试pip install -U --no-cache-dir --force psycopg2
这个错误有点烦人,因为no_log
被用在它突然出现的情况下,例如创建用户,掩盖了真正的问题。
我个人通过在导入 Postgres 角色之前使用package
安装python3-psycopg2
来修复它。
Ubuntu 上的旧线程(但打开)相同的问题。 删除 no_log 给了我丢失包的错误消息。 手动安装 psycopg2 后,用户的任务正在运行。 安装所需的 python 包的额外步骤应该可以解决这个问题。
我已经安装了 python3-psycopg2 但它仍然失败了;
postgresql_python_library:python3-psycopg2
所以我在我的剧本中添加了以下内容;
ansible_python_interpreter:/usr/bin/python3
似乎默认情况下它只是使用 /usr/bin/python
在 debian 10 上;
/usr/bin/python --version
蟒蛇 2.7.16
由于近期没有活动,此问题已被标记为“过时”。 如果没有进一步的活动,问题将在 30 天后关闭。 感谢您的贡献!
请阅读此博客文章以了解我将问题标记为陈旧的原因。
由于不活动,此问题已关闭。 如果您觉得这是错误的,请重新打开问题或提交包含相关详细信息的新问题。
最有用的评论
我已经安装了 python3-psycopg2 但它仍然失败了;
postgresql_python_library:python3-psycopg2
所以我在我的剧本中添加了以下内容;
ansible_python_interpreter:/usr/bin/python3
似乎默认情况下它只是使用 /usr/bin/python
在 debian 10 上;
/usr/bin/python --version
蟒蛇 2.7.16