]> git.immae.eu Git - github/fretlink/ansible-postgresql-role.git/blame - tasks/postgres-user.yml
Allow to use any ansible become method
[github/fretlink/ansible-postgresql-role.git] / tasks / postgres-user.yml
CommitLineData
d0bc90e0
P
1- name: Test if the PostgreSQL server is up
2 become: true
3 become_user: postgres
29f3186f 4 become_method: "{{ postgres_become_method }}"
d0bc90e0
P
5 command: psql --port={{ postgres_port }} --command='select NOW()'
6 register: postgres_up
7 ignore_errors: yes
8 check_mode: no
9 changed_when: false
10
11- name: Create PostgreSQL user
12 become: true
13 become_user: postgres
29f3186f 14 become_method: "{{ postgres_become_method }}"
d0bc90e0
P
15 postgresql_user:
16 port: "{{ postgres_port }}"
17 name: "{{ postgres_username }}"
18 password: "{{ postgres_password }}"
19 encrypted: true
20 role_attr_flags: "{{ postgres_permissions }}"
21 when:
22 - postgres_up.rc == 0