postgresql/tasks/main.yaml
2023-02-10 17:50:56 +03:00

60 lines
1.6 KiB
YAML

- name: Make sure handlers are flushed immediately
meta: flush_handlers
- name: Load a variable file based on the OS type
include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_major_version'] }}.yaml"
- "{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_major_version'] }}.yaml"
paths:
- "vars"
tags: postgresql_vars
- name: Load host variables to override role vars
include_vars:
dir: "{{ inventory_dir }}/host_vars"
ignore_unknown_extensions: True
extensions:
- ''
- "yaml"
- "yml"
tags: postgresql_override_role_vars
- name: Load group variables to override role vars
include_vars:
dir: "{{ inventory_dir }}/group_vars"
ignore_unknown_extensions: True
extensions:
- ''
- "yaml"
- "yml"
tags: postgresql_override_role_vars
- name: "Set locale for PostgreSQL"
include_tasks: locale.yaml
tags: postgresql_locale
- name: "Install PostgreSQL for {{ ansible_facts['os_family'] }}"
include_tasks: "{{ ansible_facts['os_family'] }}/main.yaml"
tags: postgresql_setup
- name: "Manage TLS/SSL certificates"
include_tasks: cacert.yaml
when: postgresql_ssl
- name: Enable and start PostgreSQL
systemd:
daemon_reload: true
name: "{{ postgresql_unit_name }}"
enabled: true
state: started
masked: no
register: postgresql_enable_and_start
tags: postgresql, postgresql_start
- name: "Configure PostgreSQL"
include_tasks: user.yaml
tags: postgresql_postgres_user