library/roles/postgresql/tasks/manage_pg_db.yml: Use the new syntax for the privilege escalation. Use 'become' instead of 'sudo'.

This commit is contained in:
Andrea Dell'Amico 2016-01-25 18:11:43 +01:00
parent c80b73b8fa
commit f38597a4a2
1 changed files with 6 additions and 15 deletions

View File

@ -1,29 +1,20 @@
--- ---
- name: Add a user for the postgresql DBs - name: Add a user for the postgresql DBs
remote_user: root become: True
sudo: yes become_user: postgres
sudo_user: postgres
postgresql_user: user={{ item.user }} password={{ item.pwd }} role_attr_flags={{ item.roles }} postgresql_user: user={{ item.user }} password={{ item.pwd }} role_attr_flags={{ item.roles }}
with_items: psql_db_data with_items: psql_db_data
when: when:
- psql_db_data is defined - psql_db_data is defined
- item.roles is defined - item.roles is defined
tags: tags: [ 'postgresql', 'postgres', 'pg_db' ]
- postgresql
- postgres
- pg_db
- name: Add the databases with the correct owner - name: Add the databases with the correct owner
remote_user: root become: True
sudo: yes become_user: postgres
sudo_user: postgres
postgresql_db: db={{ item.name }} encoding={{ item.encoding }} owner={{ item.user }} template=template0 state=present postgresql_db: db={{ item.name }} encoding={{ item.encoding }} owner={{ item.user }} template=template0 state=present
with_items: psql_db_data with_items: psql_db_data
when: when:
- psql_db_data is defined - psql_db_data is defined
- item.roles is defined - item.roles is defined
tags: tags: [ 'postgresql', 'postgres', 'pg_db' ]
- postgresql
- postgres
- pg_db