additional restore config support

This commit is contained in:
ace
2023-02-20 12:44:18 +03:00
parent 922582e57e
commit ada55a27d0
9 changed files with 55 additions and 10 deletions

View File

@ -1,4 +1,21 @@
---
- 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: wal_g_vars
- name: Set facts about needed vars
set_fact:
wal_g_pg_home_dir: "{{ wal_g_pg_home_dir }}"
wal_g_pg_data_dir: "{{ wal_g_pg_data_dir }}"
- name: "Include install WAL-G {{ wal_g_version }} for PostgreSQL"
include_tasks: pg.yaml
when: wal_g_pg

View File

@ -4,7 +4,7 @@
name: "epel-release"
state: present
- name: "Install WAL-G for PostgreSQL"
- name: "Install WAL-G {{ wal_g_version }} for PostgreSQL"
dnf:
name: "wal-g{{ ('-' ~ wal_g_version) | default('') }}"
state: installed
@ -31,9 +31,23 @@
- name: "Generate conf file walg.json"
copy:
content: "{{ wal_g_combined_config | to_nice_json }}"
dest: "{{ wal_g_pg_home_dir }}/.walg.json"
dest: "{{ wal_g_pg_home_dir }}/{{ wal_g_config_name }}"
owner: "{{ wal_g_pg_config_owner }}"
group: "{{ wal_g_pg_config_group }}"
mode: 0644
tags: wal-g, wal_g, wal_g_conf
- name: Create wal-g restore config
when: wal_g_restore
block:
- name: Merge user options for WAL-G part of restore config
set_fact:
wal_g_restore_combined_config: "{{ wal_g_default_restore_config | combine(wal_g_restore_config|default({}), recursive=true) }}"
- name: "Generate conf file walg-restore.json"
copy:
content: "{{ wal_g_restore_combined_config | to_nice_json }}"
dest: "{{ wal_g_pg_home_dir }}/{{ wal_g_restore_config_name }}"
owner: "{{ wal_g_pg_config_owner }}"
group: "{{ wal_g_pg_config_group }}"
mode: 0644