From 29f3186f165565e03b3b091523f8b682be99404a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Helleboid?= Date: Thu, 2 May 2019 17:34:44 +0200 Subject: Allow to use any ansible become method The variable can be set to 'sudo' if ansible uses sudo --- tasks/postgres-common-postinstall.yml | 2 +- tasks/postgres-database-extensions.yml | 2 +- tasks/postgres-database.yml | 4 ++-- tasks/postgres-user.yml | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'tasks') diff --git a/tasks/postgres-common-postinstall.yml b/tasks/postgres-common-postinstall.yml index 715782c..9be3bde 100644 --- a/tasks/postgres-common-postinstall.yml +++ b/tasks/postgres-common-postinstall.yml @@ -7,7 +7,7 @@ command: ssh-keygen -b 4096 -f /var/lib/postgresql/.ssh/id_rsa -N "" -q become: yes become_user: postgres - become_method: su + become_method: "{{ postgres_become_method }}" args: creates: /var/lib/postgresql/.ssh/id_rsa diff --git a/tasks/postgres-database-extensions.yml b/tasks/postgres-database-extensions.yml index edc4e8d..58585c0 100644 --- a/tasks/postgres-database-extensions.yml +++ b/tasks/postgres-database-extensions.yml @@ -13,7 +13,7 @@ - name: "CREATE EXTENSION on database {{ postgres_dbname }}" become: true become_user: postgres - become_method: su + become_method: "{{ postgres_become_method }}" postgresql_ext: name: "{{ postgres_extension_name }}" db: "{{ postgres_dbname }}" diff --git a/tasks/postgres-database.yml b/tasks/postgres-database.yml index c3537ea..0be2dff 100644 --- a/tasks/postgres-database.yml +++ b/tasks/postgres-database.yml @@ -1,7 +1,7 @@ - name: Test if the PostgreSQL server is up become: true become_user: postgres - become_method: su + become_method: "{{ postgres_become_method }}" command: psql --port={{ postgres_port }} --command='select NOW()' register: postgres_up ignore_errors: yes @@ -11,7 +11,7 @@ - name: Create PostgreSQL database become: true become_user: postgres - become_method: su + become_method: "{{ postgres_become_method }}" postgresql_db: port: "{{ postgres_port }}" name: "{{ postgres_dbname }}" diff --git a/tasks/postgres-user.yml b/tasks/postgres-user.yml index 308dab8..fcef9fc 100644 --- a/tasks/postgres-user.yml +++ b/tasks/postgres-user.yml @@ -1,7 +1,7 @@ - name: Test if the PostgreSQL server is up become: true become_user: postgres - become_method: su + become_method: "{{ postgres_become_method }}" command: psql --port={{ postgres_port }} --command='select NOW()' register: postgres_up ignore_errors: yes @@ -11,7 +11,7 @@ - name: Create PostgreSQL user become: true become_user: postgres - become_method: su + become_method: "{{ postgres_become_method }}" postgresql_user: port: "{{ postgres_port }}" name: "{{ postgres_username }}" -- cgit v1.2.3