]> git.immae.eu Git - github/fretlink/ansible-postgresql-role.git/commitdiff
Merge pull request #9 from chtitux/become-method
authorPaul B <paul+gh@bonaud.fr>
Fri, 3 May 2019 08:59:19 +0000 (10:59 +0200)
committerGitHub <noreply@github.com>
Fri, 3 May 2019 08:59:19 +0000 (10:59 +0200)
Allow to use any ansible become method

README.md
defaults/main.yml
tasks/postgres-common-postinstall.yml
tasks/postgres-database-extensions.yml
tasks/postgres-database.yml
tasks/postgres-user.yml

index 06622c82d811011dbbbea14cde2579d6244d1d68..5482bc60947065f9223d16a8c52ccd12af97b96c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -75,6 +75,9 @@ postgres_allowed_hosts:
 postgres_replication_hosts:
   - user: replicator
     range: 10.0.0.0/24
+
+# Ansible related Configuration
+postgres_become_method: su  # Optional
 ```
 
 #### Testing
index 190ce5f82653209018014532f2d819e27620950f..5876e943ffd44b9674835ed7315cf468861ad9b6 100644 (file)
@@ -7,6 +7,8 @@ postgres_clusters: []
 # postgres_pgbadger_server: ~
 postgres_backup_enabled: false
 postgres_barman_rsync_enabled: false
+
+postgres_become_method: su
 #------------------------------------------------------------#
 #------------ Postgresql Configuration defaults -------------#
 #- WARNING: defaults can change with major version upgrades -#
index 715782c5a2ed5f8ba580314b945dd3272dfc4c45..9be3bde5bbce3564094189fa66257053d9b08608 100644 (file)
@@ -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
 
index edc4e8d48a9190f0ee48fc78706b6d5727995d4b..58585c028b11f95d51ca9589d81ef7d9bad5a9fb 100644 (file)
@@ -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 }}"
index c3537eaaeef61c7b30121b348885d1e38bad64cf..0be2dffcecbffb02c5a492692dd43128ff2eb032 100644 (file)
@@ -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 }}"
index 308dab839ef65aa1e0b5749e202138247ca0db68..fcef9fc42717017efd8d2ff7341964c68a10b3fd 100644 (file)
@@ -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 }}"