patroni/tasks/main.yaml
2023-02-10 17:44:03 +03:00

64 lines
1.5 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'] }}.yaml"
- "{{ ansible_facts['os_family'] }}.yaml"
paths:
- "vars"
tags: always, patroni_vars
- name: Load host variables to override role vars
include_vars:
dir: "{{ inventory_dir }}/host_vars"
ignore_unknown_extensions: True
extensions:
- ''
- "yaml"
- "yml"
tags: patroni_override_role_vars
- name: Load group variables to override role vars
include_vars:
dir: "{{ inventory_dir }}/group_vars"
extensions:
- "yaml"
- "yml"
tags: patroni_override_role_vars
- name: Task name
stat:
path: /etc/patroni/patroni.yaml
register: patroni_config
- name: "Install Patroni for {{ ansible_facts['os_family'] }}"
include_tasks: "{{ ansible_facts['os_family'] }}/main.yaml"
tags: patroni_install
- name: "Bootstrap Patroni configuration"
include_tasks: config.yaml
when: not patroni_config.stat.exists
tags: patroni_configure
- name: Enable and start patroni
systemd:
daemon_reload: true
name: patroni
enabled: true
state: started
masked: no
register: patroni_enable_and_start
tags: patroni, patroni_start
- name: "Dynamic Patroni configuration"
include_tasks: dynamic_config.yaml
when:
#- patroni_config.stat.exists
- patroni_postgresql_dynamic_parameters
tags: patroni_dynamic_configure