aboutsummaryrefslogblamecommitdiffhomepage
path: root/tasks/main.yml
blob: 3d1892c787e98ec9b32c31de3615ca68f8b375c9 (plain) (tree)





















                                                                                                                                               


                                 






















                                                               
                                                           









                                   


                                   



                                      
---
- 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