Hi,

I'm using "ansible 1.9 (devel b11be68249) last updated 2015/03/17 12:39:00 
(GMT +000)" and am facing an issue with the 'sudo_user' switch.
My role fails on the postgres user not being able to be authenticated.
The ansible command host is Ubuntu, ansible target is localhost

My playbook looks like this:

---------------------------------
- hosts: db_server
  sudo: yes
  roles:
    - esc-db-init
    - { role: esc-db, sudo_user: postgres }
---------------------------------

and a few initial tasks of the esc-db role look like this:

---------------------------------
- name: Create the database user
  postgresql_user: name={{ db_user }} password={{ db_password }}

- name: Create databeses required by the server
  postgresql_db: name=connexience   encoding='UTF-8' owner={{ db_user }} 
state=present
- postgresql_db: name=logeventsdb   encoding='UTF-8' owner={{ db_user }} 
state=present
- postgresql_db: name=performancedb encoding='UTF-8' owner={{ db_user }} 
state=present

...
----------------------------------

Running this with the latest ansible fails on the postgresql_user task with 
error:

-----------------------------------
failed: [localhost] => {"failed": true}
msg: unable to connect to database: FATAL:  Peer authentication failed for 
user "postgres"
-----------------------------------

But when I modify the first task of the esc-db role:

----------------------------------
- name: Create the database user
  postgresql_user: name={{ db_user }} password={{ db_password }}
  sudo_user: postgres

- name: Create databeses required by the server
  postgresql_db: name=connexience   encoding='UTF-8' owner={{ db_user }} 
state=present
- postgresql_db: name=logeventsdb   encoding='UTF-8' owner={{ db_user }} 
state=present
- postgresql_db: name=performancedb encoding='UTF-8' owner={{ db_user }} 
state=present

...
----------------------------------

The first task runs ok but the role fails on the next one with exactly the 
same error. It looks like 'sudo_user: postgres' set at the playbook level 
isn't properly passed down to the role.
The problem doesn't appear on an earlier version: "ansible 1.9 (devel 
ffb281d96c) last updated 2015/03/03 19:12:13 (GMT +100)"

Any help appreciated.

  Cheers,
  Jacek

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b2e47499-2071-4f65-a2ac-275cb729e912%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to