]> git.immae.eu Git - github/fretlink/ansible-postgresql-role.git/blame - tasks/postgres-user.yml
tests: running tests on all supported PG versions
[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
0415357e
P
11- name: "Install required packages for 'postgres_user' ansible module"
12 apt:
13 name:
14 - libpq-dev
15 - python-psycopg2
16
d0bc90e0
P
17- name: Create PostgreSQL user
18 become: true
19 become_user: postgres
29f3186f 20 become_method: "{{ postgres_become_method }}"
d0bc90e0
P
21 postgresql_user:
22 port: "{{ postgres_port }}"
23 name: "{{ postgres_username }}"
24 password: "{{ postgres_password }}"
25 encrypted: true
26 role_attr_flags: "{{ postgres_permissions }}"
27 when:
28 - postgres_up.rc == 0