postgresql/tasks/main.yaml
2024-03-19 14:05:41 +03:00

43 lines
1.4 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['distribution'] }}-{{ ansible_facts['distribution_version'] }}.yaml"
- "{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_major_version'] }}.yaml"
- "{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_version'] }}.yaml"
paths:
- "vars"
tags: postgresql_vars
- name: Set facts about needed vars
set_fact:
postgresql_home_dir: "{{ postgresql_home_dir }}"
postgresql_data_dir: "{{ postgresql_data_dir }}"
- name: "Set locale for PostgreSQL"
include_tasks: locale.yaml
tags: postgresql_locale
- name: "Install PostgreSQL for {{ ansible_facts['distribution'] }}"
include_tasks: "{{ ansible_facts['os_family'] }}/main.yaml"
tags: postgresql_setup
- 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