aboutsummaryrefslogtreecommitdiffhomepage
path: root/tasks/main.yml
blob: 3d1892c787e98ec9b32c31de3615ca68f8b375c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
- include: postgres-common-preinstall.yml
  tags:
    - postgres

- include: postgres-log-directory.yml
  tags:
    - postgres
  when:
   - postgres_log_dir is defined and postgres_log_dir

- include: postgres-data-directory.yml
  tags:
    - postgres
  when: postgres_data_dir is defined and postgres_data_dir

- name: fail if no clusters are defined
  fail:
    msg: "You probably forgot to define a PostgreSQL cluster on your host (`postgres_clusters` variable). Stopping run of the PostgreSQL role."
  when: (postgres_clusters is not defined) or (postgres_clusters|length == 0)

- include: postgres-cluster.yml
  loop: "{{ postgres_clusters }}"
  loop_control:
    loop_var: postgres_cluster
  tags:
    - postgres

- include: postgres-common-postinstall.yml
  tags:
    - postgres

- include: postgres-user.yml
    postgres_username={{ item.1.username }}
    postgres_password={{ item.1.password }}
    postgres_port={{ item.0.port }}
    postgres_permissions={{ item.1.permissions | default('') }}
  with_subelements:
    - "{{ postgres_clusters }}"
    - users
    - skip_missing: true
  tags:
    - postgres
    - postgres-users

- include: postgres-database.yml
    postgres_dbname={{ item.1.dbname }}
    postgres_owner={{ item.1.owner }}
    postgres_extensions={{ item.1.extensions|default([]) }}
    postgres_port={{ item.0.port }}
  with_subelements:
    - "{{ postgres_clusters }}"
    - databases
    - skip_missing: true
  tags:
    - postgres
    - postgres-databases

- include: postgres-pgupgrades.yml
  loop: "{{ postgres_pgupgrades }}"
  loop_control:
    loop_var: postgres_pgupgrade
  when: postgres_pgupgrades is defined
  tags:
    - postgres
    - postgres-pgupgrades