2023-02-07 23:13:12 +00:00
|
|
|
- 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:
|
2023-02-09 21:49:13 +00:00
|
|
|
- "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_major_version'] }}.yaml"
|
2023-03-15 09:26:09 +00:00
|
|
|
- "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_version'] }}.yaml"
|
2023-02-09 21:49:13 +00:00
|
|
|
- "{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_major_version'] }}.yaml"
|
2023-03-15 09:26:09 +00:00
|
|
|
- "{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_version'] }}.yaml"
|
2023-02-07 23:13:12 +00:00
|
|
|
paths:
|
|
|
|
- "vars"
|
|
|
|
tags: postgresql_vars
|
|
|
|
|
2023-02-17 15:13:08 +00:00
|
|
|
- name: Set facts about needed vars
|
|
|
|
set_fact:
|
2023-02-21 13:14:02 +00:00
|
|
|
postgresql_home_dir: "{{ postgresql_home_dir }}"
|
2023-02-17 15:13:08 +00:00
|
|
|
postgresql_data_dir: "{{ postgresql_data_dir }}"
|
2023-02-10 11:34:38 +00:00
|
|
|
|
2023-02-09 21:49:13 +00:00
|
|
|
- name: "Set locale for PostgreSQL"
|
|
|
|
include_tasks: locale.yaml
|
|
|
|
tags: postgresql_locale
|
|
|
|
|
2023-03-15 11:04:55 +00:00
|
|
|
- name: "Install PostgreSQL for {{ ansible_facts['distribution'] }}"
|
2023-02-07 23:13:12 +00:00
|
|
|
include_tasks: "{{ ansible_facts['os_family'] }}/main.yaml"
|
|
|
|
tags: postgresql_setup
|
|
|
|
|
|
|
|
- name: Enable and start PostgreSQL
|
|
|
|
systemd:
|
|
|
|
daemon_reload: true
|
2023-02-09 21:49:13 +00:00
|
|
|
name: "{{ postgresql_unit_name }}"
|
2023-02-07 23:13:12 +00:00
|
|
|
enabled: true
|
|
|
|
state: started
|
|
|
|
masked: no
|
|
|
|
register: postgresql_enable_and_start
|
|
|
|
tags: postgresql, postgresql_start
|
|
|
|
|
2024-05-26 14:56:35 +00:00
|
|
|
- name: "Configure initial PostgreSQL user"
|
2023-02-07 23:13:12 +00:00
|
|
|
include_tasks: user.yaml
|
|
|
|
tags: postgresql_postgres_user
|