mirror of
https://gitea.0xace.cc/ansible-galaxy/wal-g.git
synced 2024-11-25 07:57:25 +00:00
54 lines
1.8 KiB
YAML
54 lines
1.8 KiB
YAML
---
|
|
- name: "Install EPEL"
|
|
dnf:
|
|
name: "epel-release"
|
|
state: present
|
|
|
|
- name: "Install WAL-G {{ wal_g_version }} for PostgreSQL"
|
|
dnf:
|
|
name: "wal-g{{ ('-' ~ wal_g_version) | default('') }}"
|
|
state: installed
|
|
update_cache: yes
|
|
allow_downgrade: yes
|
|
tags: wal-g, wal_g, wal_g_install
|
|
|
|
- name: "Gather packages"
|
|
package_facts:
|
|
manager: auto
|
|
|
|
- name: "Set fact about PostgreSQL package"
|
|
set_fact:
|
|
wal_g_postgresql_package: "{{ ansible_facts.packages | list | select('match', wal_g_pg_package_name_regex) | first }}"
|
|
|
|
- name: "Get PostgreSQL major version"
|
|
set_fact:
|
|
wal_g_pg_major_version: "{{ ansible_facts.packages[wal_g_postgresql_package][0]['version'] | split('.') | first }}"
|
|
|
|
- name: Merge user options for WAL-G part of config
|
|
set_fact:
|
|
wal_g_combined_config: "{{ wal_g_default_config | combine(wal_g_config|default({}), recursive=true) }}"
|
|
|
|
- name: "Generate conf file walg.json"
|
|
copy:
|
|
content: "{{ wal_g_combined_config | to_nice_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
|