PostgreSQL failing peer authentication with Ansible -
i running postgresql 9.3 on freebsd. freebsd uses pgsql default system user postgresql. /usr/local/pgsql/data/pg_hba.conf looks this:
# type database user address method local pgsql peer local md5 host 127.0.0.1/32 md5 host ::1/128 md5 with configuration can connect database pgsql without password.
$ su pgsql $ psql template1 template1=# \l list of databases ... that works intended.
on remote machine, have ansible task create database on freebsd server.
- name: create postgresql database postgresql_db: name=mydatabase login_user=pgsql executing task fails error peer authentication failed user "pgsql".
play [web] ******************************************************************** gathering facts *************************************************************** ok: [host.example.org] task: [database | create postgresql database] ***************************** failed: [host.example.org] => {"failed": true} msg: unable connect database: fatal: peer authentication failed user "pgsql" fatal: hosts have failed -- aborting why fail when peer authentication user pgsql working?
this worked me:
- name: create postgres database become: true become_user: postgres postgresql_db: name: <database-name> in specific case user might pgsql, think user postgres.
Comments
Post a Comment