2023-08-11 07:01:30 +00:00
|
|
|
- hosts: localhost
|
|
|
|
gather_facts: false
|
|
|
|
tasks:
|
|
|
|
- name: Print Ansible version
|
|
|
|
debug:
|
|
|
|
msg: "{{ ansible_version }}"
|
|
|
|
|
|
|
|
- hosts: all,!localhost
|
|
|
|
gather_facts: false
|
|
|
|
tasks:
|
|
|
|
- name: Wait 300 seconds
|
|
|
|
ansible.builtin.wait_for_connection:
|
|
|
|
timeout: 300
|
|
|
|
|
|
|
|
- hosts: all,!localhost
|
|
|
|
tasks:
|
|
|
|
- name: Include PostgreSQL vars
|
|
|
|
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
|
|
|
|
vars:
|
|
|
|
params:
|
|
|
|
files:
|
|
|
|
- "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_major_version'] }}.yaml"
|
|
|
|
- "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_version'] }}.yaml"
|
|
|
|
- "{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_major_version'] }}.yaml"
|
|
|
|
- "{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_version'] }}.yaml"
|
2023-09-30 18:20:47 +00:00
|
|
|
- "{{ ansible_distribution }}.yaml"
|
|
|
|
- "{{ ansible_os_family }}.yaml"
|
2023-08-11 07:01:30 +00:00
|
|
|
- postgresql.yaml
|
|
|
|
paths:
|
2023-09-30 18:20:47 +00:00
|
|
|
- "vars"
|
2023-08-11 07:01:30 +00:00
|
|
|
|
|
|
|
- hosts: all,!localhost
|
|
|
|
become: true
|
|
|
|
tasks:
|
|
|
|
- name: Debian based repository
|
|
|
|
when: ansible_facts['os_family'] == "Debian"
|
|
|
|
block:
|
|
|
|
- name: Add repository for Debian
|
|
|
|
copy:
|
|
|
|
dest: /etc/apt/sources.list.d/mirror.0xace.cc.list
|
|
|
|
content: |
|
|
|
|
deb [trusted=yes] https://mirror.0xace.cc/debian/consul/ default all
|
|
|
|
deb [trusted=yes] https://mirror.0xace.cc/debian/custom/ default all
|
|
|
|
|
|
|
|
- name: RHEL based repository
|
|
|
|
when: ansible_facts['os_family'] == "RedHat"
|
|
|
|
block:
|
|
|
|
- name: Add custom 0xace.cc repository for RHEL
|
|
|
|
ansible.builtin.yum_repository:
|
|
|
|
name: "rhel-custom"
|
|
|
|
description: "RHEL custom 0xace.cc repository"
|
|
|
|
file: "mirror.0xace.cc"
|
|
|
|
baseurl: "https://mirror.0xace.cc/rhel/$releasever/custom"
|
|
|
|
gpgcheck: false
|
|
|
|
enabled: true
|
|
|
|
|
|
|
|
- hosts: postgresql
|
|
|
|
gather_facts: true
|
|
|
|
become: true
|
|
|
|
tasks:
|
|
|
|
- import_role:
|
|
|
|
name: postgresql
|
|
|
|
- import_role:
|
|
|
|
name: pgbouncer
|
|
|
|
- import_role:
|
|
|
|
name: postgres-exporter
|
|
|
|
- import_role:
|
|
|
|
name: node-exporter
|