aboutsummaryrefslogtreecommitdiffhomepage
path: root/tasks
diff options
context:
space:
mode:
authorThéophile Helleboid <theophile.helleboid@captaintrain.com>2019-05-02 17:34:44 +0200
committerThéophile Helleboid <theophile.helleboid@captaintrain.com>2019-05-02 17:34:44 +0200
commit29f3186f165565e03b3b091523f8b682be99404a (patch)
tree214db2306ef4a929da043d0209ca70bde78ee28b /tasks
parent0c83dd00b4110d55b1602ca8d732a8cb414cfd0a (diff)
downloadansible-postgresql-role-29f3186f165565e03b3b091523f8b682be99404a.tar.gz
ansible-postgresql-role-29f3186f165565e03b3b091523f8b682be99404a.tar.zst
ansible-postgresql-role-29f3186f165565e03b3b091523f8b682be99404a.zip
Allow to use any ansible become method
The variable can be set to 'sudo' if ansible uses sudo
Diffstat (limited to 'tasks')
-rw-r--r--tasks/postgres-common-postinstall.yml2
-rw-r--r--tasks/postgres-database-extensions.yml2
-rw-r--r--tasks/postgres-database.yml4
-rw-r--r--tasks/postgres-user.yml4
4 files changed, 6 insertions, 6 deletions
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 @@
7 command: ssh-keygen -b 4096 -f /var/lib/postgresql/.ssh/id_rsa -N "" -q 7 command: ssh-keygen -b 4096 -f /var/lib/postgresql/.ssh/id_rsa -N "" -q
8 become: yes 8 become: yes
9 become_user: postgres 9 become_user: postgres
10 become_method: su 10 become_method: "{{ postgres_become_method }}"
11 args: 11 args:
12 creates: /var/lib/postgresql/.ssh/id_rsa 12 creates: /var/lib/postgresql/.ssh/id_rsa
13 13
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 @@
13- name: "CREATE EXTENSION on database {{ postgres_dbname }}" 13- name: "CREATE EXTENSION on database {{ postgres_dbname }}"
14 become: true 14 become: true
15 become_user: postgres 15 become_user: postgres
16 become_method: su 16 become_method: "{{ postgres_become_method }}"
17 postgresql_ext: 17 postgresql_ext:
18 name: "{{ postgres_extension_name }}" 18 name: "{{ postgres_extension_name }}"
19 db: "{{ postgres_dbname }}" 19 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 @@
1- name: Test if the PostgreSQL server is up 1- name: Test if the PostgreSQL server is up
2 become: true 2 become: true
3 become_user: postgres 3 become_user: postgres
4 become_method: su 4 become_method: "{{ postgres_become_method }}"
5 command: psql --port={{ postgres_port }} --command='select NOW()' 5 command: psql --port={{ postgres_port }} --command='select NOW()'
6 register: postgres_up 6 register: postgres_up
7 ignore_errors: yes 7 ignore_errors: yes
@@ -11,7 +11,7 @@
11- name: Create PostgreSQL database 11- name: Create PostgreSQL database
12 become: true 12 become: true
13 become_user: postgres 13 become_user: postgres
14 become_method: su 14 become_method: "{{ postgres_become_method }}"
15 postgresql_db: 15 postgresql_db:
16 port: "{{ postgres_port }}" 16 port: "{{ postgres_port }}"
17 name: "{{ postgres_dbname }}" 17 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 @@
1- name: Test if the PostgreSQL server is up 1- name: Test if the PostgreSQL server is up
2 become: true 2 become: true
3 become_user: postgres 3 become_user: postgres
4 become_method: su 4 become_method: "{{ postgres_become_method }}"
5 command: psql --port={{ postgres_port }} --command='select NOW()' 5 command: psql --port={{ postgres_port }} --command='select NOW()'
6 register: postgres_up 6 register: postgres_up
7 ignore_errors: yes 7 ignore_errors: yes
@@ -11,7 +11,7 @@
11- name: Create PostgreSQL user 11- name: Create PostgreSQL user
12 become: true 12 become: true
13 become_user: postgres 13 become_user: postgres
14 become_method: su 14 become_method: "{{ postgres_become_method }}"
15 postgresql_user: 15 postgresql_user:
16 port: "{{ postgres_port }}" 16 port: "{{ postgres_port }}"
17 name: "{{ postgres_username }}" 17 name: "{{ postgres_username }}"