aboutsummaryrefslogtreecommitdiffhomepage
path: root/tasks/postgres-user.yml
diff options
context:
space:
mode:
authorPaul B <paul.bonaud@capitainetrain.com>2018-08-31 11:49:09 +0200
committerPaul B <paul.bonaud@capitainetrain.com>2018-08-31 12:00:24 +0200
commitd0bc90e08c29e881c388c6803ed9c49dff1f1776 (patch)
treee5f633a7461f3d339ef89758fc7bb3f1b91563d3 /tasks/postgres-user.yml
downloadansible-postgresql-role-d0bc90e08c29e881c388c6803ed9c49dff1f1776.tar.gz
ansible-postgresql-role-d0bc90e08c29e881c388c6803ed9c49dff1f1776.tar.zst
ansible-postgresql-role-d0bc90e08c29e881c388c6803ed9c49dff1f1776.zip
Initial commit open sourcing Postgresql Ansible role1.0.0
Diffstat (limited to 'tasks/postgres-user.yml')
-rw-r--r--tasks/postgres-user.yml22
1 files changed, 22 insertions, 0 deletions
diff --git a/tasks/postgres-user.yml b/tasks/postgres-user.yml
new file mode 100644
index 0000000..308dab8
--- /dev/null
+++ b/tasks/postgres-user.yml
@@ -0,0 +1,22 @@
1- name: Test if the PostgreSQL server is up
2 become: true
3 become_user: postgres
4 become_method: su
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
14 become_method: su
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