From f38597a4a28997a10a6cdb52397c31d24e569c37 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Mon, 25 Jan 2016 18:11:43 +0100 Subject: [PATCH] library/roles/postgresql/tasks/manage_pg_db.yml: Use the new syntax for the privilege escalation. Use 'become' instead of 'sudo'. --- postgresql/tasks/manage_pg_db.yml | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/postgresql/tasks/manage_pg_db.yml b/postgresql/tasks/manage_pg_db.yml index da92d7a5..40812a6d 100644 --- a/postgresql/tasks/manage_pg_db.yml +++ b/postgresql/tasks/manage_pg_db.yml @@ -1,29 +1,20 @@ --- - name: Add a user for the postgresql DBs - remote_user: root - sudo: yes - sudo_user: postgres + become: True + become_user: postgres postgresql_user: user={{ item.user }} password={{ item.pwd }} role_attr_flags={{ item.roles }} with_items: psql_db_data when: - psql_db_data is defined - item.roles is defined - tags: - - postgresql - - postgres - - pg_db + tags: [ 'postgresql', 'postgres', 'pg_db' ] - name: Add the databases with the correct owner - remote_user: root - sudo: yes - sudo_user: postgres + become: True + become_user: postgres postgresql_db: db={{ item.name }} encoding={{ item.encoding }} owner={{ item.user }} template=template0 state=present with_items: psql_db_data when: - psql_db_data is defined - item.roles is defined - tags: - - postgresql - - postgres - - pg_db - + tags: [ 'postgresql', 'postgres', 'pg_db' ]