postgres_replication_hosts:
- user: replicator
range: 10.0.0.0/24
+
+# Ansible related Configuration
+postgres_become_method: su # Optional
```
#### Testing
# 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 -#
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
- 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 }}"
- 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
- 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 }}"
- 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
- 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 }}"