mirror of
https://gitea.0xace.cc/ansible-galaxy/wal-g.git
synced 2024-11-24 23:36:40 +00:00
split vars for RedHat and Debian os family
This commit is contained in:
parent
654135fb2c
commit
e119bab25c
@ -1 +1,6 @@
|
||||
Setup WAL-G for RHEL8
|
||||
Setup WAL-G
|
||||
|
||||
Tested with OS:
|
||||
- AlmaLinux 8/9
|
||||
- Debian 11
|
||||
- Ubuntu 20.04/22.04
|
||||
|
@ -1,4 +1,5 @@
|
||||
wal_g_version: "2.0.1-3.el{{ ansible_distribution_major_version }}"
|
||||
wal_g_version: "2.0.1"
|
||||
wal_g_install_repo: true
|
||||
|
||||
wal_g_pg: false
|
||||
wal_g_restore: false
|
||||
@ -17,6 +18,11 @@ wal_g_backup_retention_schedule: ""
|
||||
wal_g_backup_retention_number: 7
|
||||
wal_g_backup_permanent_schedule: ""
|
||||
|
||||
wal_g_postgresql_supported_versions:
|
||||
- 13
|
||||
- 14
|
||||
- 15
|
||||
|
||||
wal_g_default_config: # more options see https://github.com/wal-g/wal-g#configuration
|
||||
# AWS_ACCESS_KEY_ID: "secret-key"
|
||||
# AWS_SECRET_ACCESS_KEY: "access-key"
|
||||
|
@ -1,10 +1,3 @@
|
||||
- name: Install curl and jq
|
||||
dnf:
|
||||
name:
|
||||
- jq
|
||||
- curl
|
||||
state: present
|
||||
|
||||
- name: Template backup script
|
||||
template:
|
||||
src: backup.sh.j2
|
||||
|
@ -1,10 +1,3 @@
|
||||
- name: Install curl and jq
|
||||
dnf:
|
||||
name:
|
||||
- jq
|
||||
- curl
|
||||
state: present
|
||||
|
||||
- name: Template backup permanent script
|
||||
template:
|
||||
src: backup-permanent.sh.j2
|
||||
|
@ -1,10 +1,3 @@
|
||||
- name: Install curl and jq
|
||||
dnf:
|
||||
name:
|
||||
- jq
|
||||
- curl
|
||||
state: present
|
||||
|
||||
- name: Template backup retention script
|
||||
template:
|
||||
src: backup-retention.sh.j2
|
||||
|
@ -1,16 +1,68 @@
|
||||
---
|
||||
- name: "Install EPEL"
|
||||
dnf:
|
||||
name: "epel-release"
|
||||
state: present
|
||||
- name: RHEL based distros
|
||||
when: ansible_os_family == "RedHat"
|
||||
block:
|
||||
- name: Install WAL-G repository
|
||||
ansible.builtin.yum_repository:
|
||||
name: "{{ item.name }}"
|
||||
description: "{{ item.description }}"
|
||||
file: "{{ item.file }}"
|
||||
baseurl: "{{ item.baseurl }}"
|
||||
gpgcheck: "{{ item.gpgcheck | default('no') }}"
|
||||
enabled: "{{ item.enabled | default('yes') }}"
|
||||
repo_gpgcheck: "{{ item.repo_gpgcheck | default('no') }}"
|
||||
gpgkey: "{{ item.gpgkey | default('omit') }}"
|
||||
loop: "{{ wal_g_rpm_repository }}"
|
||||
when: wal_g_install_repo
|
||||
|
||||
- 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: "Install WAL-G {{ wal_g_version }}"
|
||||
dnf:
|
||||
name: "{{ wal_g_package }}"
|
||||
state: present
|
||||
update_cache: yes
|
||||
allow_downgrade: yes
|
||||
tags: wal-g, wal_g, wal_g_install
|
||||
|
||||
- name: "Install curl and jq"
|
||||
dnf:
|
||||
name:
|
||||
- curl
|
||||
- jq
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: Debian based distros
|
||||
when: ansible_os_family == "Debian"
|
||||
block:
|
||||
- name: Install apt-transport-https
|
||||
apt:
|
||||
name: apt-transport-https
|
||||
state: present
|
||||
|
||||
- name: Add WAL-G repository
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "{{ item.repo }}"
|
||||
state: present
|
||||
filename: "{{ item.filename }}"
|
||||
update_cache: yes
|
||||
loop: "{{ wal_g_apt_repository }}"
|
||||
when: wal_g_install_repo
|
||||
|
||||
- name: "Install WAL-G {{ wal_g_version }}"
|
||||
apt:
|
||||
name: "{{ wal_g_package }}"
|
||||
state: present
|
||||
update_cache: yes
|
||||
allow_downgrade: yes
|
||||
tags: wal-g, wal_g, wal_g_install
|
||||
|
||||
- name: "Install curl and jq"
|
||||
apt:
|
||||
name:
|
||||
- curl
|
||||
- jq
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: "Gather packages"
|
||||
package_facts:
|
||||
@ -18,7 +70,7 @@
|
||||
|
||||
- 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 }}"
|
||||
wal_g_postgresql_package: "{{ ansible_facts.packages | list | select('match', wal_g_postgresql_package_name_regex) | first }}"
|
||||
|
||||
- name: "Get PostgreSQL major version"
|
||||
set_fact:
|
||||
|
@ -1,3 +1,13 @@
|
||||
wal_g_apt_repository:
|
||||
- repo: deb [trusted=yes] https://mirror.0xace.cc/debian/custom/ default all
|
||||
filename: mirror.0xace.cc
|
||||
|
||||
wal_g_pg_home_dir: "/var/lib/postgresql"
|
||||
wal_g_pg_data_dir: "{{ wal_g_pg_home_dir }}/{{ wal_g_pg_major_version }}/{{ wal_g_pg_cluster_name }}"
|
||||
wal_g_pg_cluster_name: "main"
|
||||
|
||||
wal_g_postgresql_package_name_regex: 'postgresql-.[{{ wal_g_postgresql_supported_versions | join(",") }}]'
|
||||
|
||||
wal_g_package_name: "wal-g"
|
||||
wal_g_package: "{{ wal_g_package_name }}={{ wal_g_version }}-{{ wal_g_version_build }}"
|
||||
wal_g_version_build: "4"
|
||||
|
@ -1,2 +1,14 @@
|
||||
wal_g_rpm_repository:
|
||||
- name: "mirror.0xace.cc"
|
||||
file: "mirror.0xace.cc"
|
||||
description: "0xace.cc repository"
|
||||
baseurl: "https://mirror.0xace.cc/rhel/$releasever/custom/"
|
||||
gpgcheck: no
|
||||
|
||||
wal_g_pg_home_dir: "/var/lib/pgsql"
|
||||
wal_g_pg_data_dir: "{{ wal_g_pg_home_dir }}/{{ wal_g_pg_major_version }}/data"
|
||||
|
||||
wal_g_postgresql_package_name_regex: 'postgresql.[{{ wal_g_postgresql_supported_versions | join(",") }}]-server'
|
||||
|
||||
wal_g_package_name: "wal-g"
|
||||
wal_g_package: "{{ wal_g_package_name }}-{{ wal_g_version }}"
|
||||
|
Loading…
Reference in New Issue
Block a user