Ansible-role-postgresql: 需要 psycopg2 模块(存在模块)

创建于 2018-07-27  ·  6评论  ·  资料来源: geerlingguy/ansible-role-postgresql

  1. pip 列表显示 psycopg2 (2.7.5)
  2. yum 显示这个包 python-psycopg2-2.7.5-1.rhel7.x86_64 已经安装和最新版本
    2a: python --version: Python 2.7.5
  3. Ansible yml 有这个:
  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 
  1. 抛出的错误是这样的:

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"}
环境:

  1. Centos 7
  2. 蟒蛇 2.7.5
  3. ansible 2.7.0.dev0 (stable-2.6 28d0a173db) 最后更新 2018/06/25 12:12:39 (GMT -500)

知道如何解决这个问题吗?

stale

最有用的评论

我已经安装了 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

所有6条评论

试试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 天后关闭。 感谢您的贡献!

请阅读此博客文章以了解我将问题标记为陈旧的原因。

由于不活动,此问题已关闭。 如果您觉得这是错误的,请重新打开问题或提交包含相关详细信息的新问题。

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

worldofchris picture worldofchris  ·  8评论

GoodBoy962 picture GoodBoy962  ·  10评论

NiftyMist picture NiftyMist  ·  5评论

breml picture breml  ·  9评论

FilBot3 picture FilBot3  ·  18评论