]> git.immae.eu Git - github/fretlink/ansible-postgresql-role.git/blame - tasks/main.yml
improvement: remove 'with_items' loop and use modern ansible loops
[github/fretlink/ansible-postgresql-role.git] / tasks / main.yml
CommitLineData
d0bc90e0
P
1---
2- include: postgres-common-preinstall.yml
3 tags:
4 - postgres
5
6- include: postgres-log-directory.yml
7 tags:
8 - postgres
9 when:
10 - postgres_log_dir is defined and postgres_log_dir
11
12- include: postgres-data-directory.yml
13 tags:
14 - postgres
15 when: postgres_data_dir is defined and postgres_data_dir
16
17- name: fail if no clusters are defined
18 fail:
19 msg: "You probably forgot to define a PostgreSQL cluster on your host (`postgres_clusters` variable). Stopping run of the PostgreSQL role."
20 when: (postgres_clusters is not defined) or (postgres_clusters|length == 0)
21
22- include: postgres-cluster.yml
f1a9ab46
P
23 loop: "{{ postgres_clusters }}"
24 loop_control:
25 loop_var: postgres_cluster
d0bc90e0
P
26 tags:
27 - postgres
28
29- include: postgres-common-postinstall.yml
30 tags:
31 - postgres
32
33- include: postgres-user.yml
34 postgres_username={{ item.1.username }}
35 postgres_password={{ item.1.password }}
36 postgres_port={{ item.0.port }}
37 postgres_permissions={{ item.1.permissions | default('') }}
38 with_subelements:
39 - "{{ postgres_clusters }}"
40 - users
41 - skip_missing: true
42 tags:
43 - postgres
44 - postgres-users
45
46- include: postgres-database.yml
47 postgres_dbname={{ item.1.dbname }}
48 postgres_owner={{ item.1.owner }}
49 postgres_port={{ item.0.port }}
50 with_subelements:
51 - "{{ postgres_clusters }}"
52 - databases
53 - skip_missing: true
54 tags:
55 - postgres
56 - postgres-databases
57
58- include: postgres-pgupgrades.yml
f1a9ab46
P
59 loop: "{{ postgres_pgupgrades }}"
60 loop_control:
61 loop_var: postgres_pgupgrade
d0bc90e0
P
62 when: postgres_pgupgrades is defined
63 tags:
64 - postgres
65 - postgres-pgupgrades