mirror of
https://gitea.0xace.cc/ansible-galaxy/pgbouncer.git
synced 2025-06-28 18:53:08 +00:00
split variables for RedHat and Debain os family
This commit is contained in:
@ -1,50 +1,48 @@
|
||||
---
|
||||
# yamllint disable rule:line-length
|
||||
|
||||
- name: Make sure handlers are flushed immediately
|
||||
meta: flush_handlers
|
||||
|
||||
- name: Gather packages
|
||||
package_facts:
|
||||
manager: auto
|
||||
|
||||
- name: Load a variable file based on the OS type
|
||||
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"
|
||||
- "{{ ansible_facts['distribution'] }}.yaml"
|
||||
- "{{ ansible_facts['os_family'] }}.yaml"
|
||||
paths:
|
||||
- "vars"
|
||||
tags: pgbouncer_vars
|
||||
|
||||
- name: "Gather packages"
|
||||
package_facts:
|
||||
manager: auto
|
||||
|
||||
- name: "Set fact about PostgreSQL package"
|
||||
set_fact:
|
||||
pgbouncer_postgresql_package_name: "{{ ansible_facts.packages | list | select('match', pgbouncer_postgresql_package_name_regex) | first }}"
|
||||
|
||||
- name: "Get PostgreSQL major and minor versions"
|
||||
- name: "Get PostgreSQL major version"
|
||||
set_fact:
|
||||
pgbouncer_postgresql_major_version: "{{ ansible_facts.packages[pgbouncer_postgresql_package_name][0]['version'] | split('.') | first }}"
|
||||
pgbouncer_postgresql_minor_version: "{{ ansible_facts.packages[pgbouncer_postgresql_package_name][0]['version'] | split('.') | last }}"
|
||||
|
||||
- name: Mask pgbouncer before install
|
||||
systemd:
|
||||
name: pgbouncer
|
||||
masked: yes
|
||||
when:
|
||||
- ansible_os_family == "Debian"
|
||||
- "'pgbouncer' not in ansible_facts.packages"
|
||||
tags: pgbouncer_mask, pgbouncer
|
||||
|
||||
- name: Install pgbouncer package
|
||||
package:
|
||||
name: pgbouncer
|
||||
environment: "{{ proxy_env | default({}) }}"
|
||||
when: ansible_os_family == "Debian" or
|
||||
(ansible_os_family == "RedHat" and
|
||||
ansible_distribution_major_version == '7')
|
||||
tags: pgbouncer_install, pgbouncer
|
||||
|
||||
# RHEL 8
|
||||
- name: Install pgbouncer package
|
||||
dnf:
|
||||
name: pgbouncer
|
||||
disablerepo: AppStream
|
||||
environment: "{{ proxy_env | default({}) }}"
|
||||
when: ansible_os_family == "RedHat" and
|
||||
ansible_distribution_major_version >= '8'
|
||||
tags: pgbouncer_install, pgbouncer
|
||||
|
||||
- name: Ensure config directory "{{ pgbouncer_conf_dir }}" exist
|
||||
@ -56,14 +54,6 @@
|
||||
mode: 0750
|
||||
tags: pgbouncer_conf, pgbouncer
|
||||
|
||||
- name: Stop and disable standard init script
|
||||
service:
|
||||
name: pgbouncer
|
||||
state: stopped
|
||||
enabled: false
|
||||
when: ansible_os_family == "Debian"
|
||||
tags: pgbouncer_service, pgbouncer
|
||||
|
||||
- name: Add pgbouncer systemd unit user and group override
|
||||
block:
|
||||
- name: Ensure override dir for pgbouncer exists
|
||||
@ -159,3 +149,4 @@
|
||||
masked: no
|
||||
register: pgbouncer_enable_and_start
|
||||
tags: pgbouncer, pgbouncer_start
|
||||
|
||||
|
Reference in New Issue
Block a user