split vars for RedHat and Debian os family

This commit is contained in:
ace
2023-04-19 00:12:30 +03:00
parent 654135fb2c
commit e119bab25c
8 changed files with 99 additions and 35 deletions

View File

@ -1,10 +1,3 @@
- name: Install curl and jq
dnf:
name:
- jq
- curl
state: present
- name: Template backup script
template:
src: backup.sh.j2

View File

@ -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

View File

@ -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

View File

@ -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: