ec2 に ansible で postgresql_db を使う時 python-psycopg2 インストールしてるのに {"failed": true "msg": "the python psycopg2 module is required"} と言われる

環境

  • ansible 2.3.2.0
  • OS AmazonLinux 多分17.03あたりの

現象

- yum: name=python-psycopg2
...

- postgresql_db: 
    ....

Error

ansible  {"failed": true  "msg": "the python psycopg2 module is required"}

対策

python27-psyconpg2 に変えて動いてくれた

- yum: name=python27-psycopg2

パスの通っていた pythonは下記 - python27 - python2.7 - python26 - python2.6 - python

python2.7-psyconpg2 は存在しないし、26、バージョン番号なしは module is required の同じエラーになった 3が入ってたら python3-psyconpg2 を使うようです。