patroni/tasks/main.yaml

66 lines
1.6 KiB
YAML
Raw Normal View History

2023-02-07 23:39:20 +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:
- "{{ ansible_facts['distribution'] }}.yaml"
- "{{ ansible_facts['os_family'] }}.yaml"
paths:
- "vars"
tags: always, patroni_vars
2023-02-10 14:44:03 +00:00
- 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"
2023-02-10 14:50:27 +00:00
ignore_unknown_extensions: True
2023-02-10 14:44:03 +00:00
extensions:
2023-02-10 14:50:27 +00:00
- ''
2023-02-10 14:44:03 +00:00
- "yaml"
- "yml"
tags: patroni_override_role_vars
2023-02-07 23:39:20 +00:00
- 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