patroni: disable full configuration
This commit is contained in:
parent
a3ec1d6712
commit
d83ae339d8
|
@ -6,3 +6,10 @@
|
|||
- etcd-client
|
||||
- etcd-server
|
||||
update_cache: yes
|
||||
|
||||
- name: Install python dependencies for Patroni
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- python3-etcd
|
||||
- python3-psycopg2
|
||||
when: etcd_install_dependencies_for_patroni | bool
|
||||
|
|
|
@ -3,39 +3,49 @@
|
|||
# Install Patroni from backport Evolix
|
||||
patroni_backport: false
|
||||
|
||||
# Define variable for Patroni
|
||||
etcd_install_dependencies_for_patroni: True
|
||||
|
||||
patroni_scope: "mycluster"
|
||||
patroni_name: "{{ patroni_scope }}-{{ ansible_hostname }}"
|
||||
#########################################################################
|
||||
# Disabled for now
|
||||
# It's too much work to completely manage a Patroni cluster from Ansible
|
||||
##########
|
||||
# # Define variable for Patroni
|
||||
|
||||
# Binding host:port for the cluster (must not be localhost)
|
||||
patroni_restapi_connect_address_host: "0.0.0.0"
|
||||
patroni_restapi_connect_address_port: "8008"
|
||||
patroni_restapi_connect_address: "{{ patroni_restapi_connect_address_host }}:{{ patroni_restapi_connect_address_port }}"
|
||||
# Additional binding for health-checks…
|
||||
patroni_restapi_listen_host: "127.0.0.1"
|
||||
patroni_restapi_listen_port: "8008"
|
||||
patroni_restapi_listen: "{{ patroni_restapi_listen_host }}:{{ patroni_restapi_listen_port }}"
|
||||
# patroni_scope: "13-main"
|
||||
# patroni_name: "{{ ansible_hostname }}"
|
||||
|
||||
patroni_postgresql_connect_address_host: "0.0.0.0"
|
||||
patroni_postgresql_connect_address_port: "5432"
|
||||
patroni_postgresql_connect_address: "{{ patroni_postgresql_connect_address_host }}:{{ patroni_postgresql_connect_address_port }}"
|
||||
# # Binding host:port for the cluster (must not be localhost)
|
||||
# patroni_restapi_connect_address_host: "0.0.0.0"
|
||||
# patroni_restapi_connect_address_port: "8008"
|
||||
# patroni_restapi_connect_address: "{{ patroni_restapi_connect_address_host }}:{{ patroni_restapi_connect_address_port }}"
|
||||
# # Additional binding for health-checks…
|
||||
# patroni_restapi_listen_host: "127.0.0.1"
|
||||
# patroni_restapi_listen_port: "8008"
|
||||
# patroni_restapi_listen: "{{ patroni_restapi_listen_host }}:{{ patroni_restapi_listen_port }}"
|
||||
|
||||
patroni_postgresql_listen_hosts:
|
||||
- "127.0.0.1"
|
||||
patroni_postgresql_listen_port: "5432"
|
||||
patroni_postgresql_listen: "{{ patroni_postgresql_listen_hosts | join(',') }}:{{ patroni_postgresql_listen_port }}"
|
||||
# patroni_postgresql_connect_address_host: "0.0.0.0"
|
||||
# patroni_postgresql_connect_address_port: "5432"
|
||||
# patroni_postgresql_connect_address: "{{ patroni_postgresql_connect_address_host }}:{{ patroni_postgresql_connect_address_port }}"
|
||||
|
||||
patroni_postgresql_datadir: "/home/{{ patroni_name }}"
|
||||
patroni_postgresql_pgpass: "/tmp/{{ patroni_name }}-pgpass"
|
||||
patroni_postgresql_hosts_cluster: []
|
||||
patroni_postgresql_listen_ips: 127.0.0.1
|
||||
patroni_postgresql_connect_ip: 127.0.0.1
|
||||
patroni_postgresql_version: ''
|
||||
patroni_postgresql_replication_user: 'repl'
|
||||
patroni_postgresql_superuser: 'admin'
|
||||
# patroni_postgresql_listen_hosts:
|
||||
# - "127.0.0.1"
|
||||
# patroni_postgresql_listen_port: "5432"
|
||||
# patroni_postgresql_listen: "{{ patroni_postgresql_listen_hosts | join(',') }}:{{ patroni_postgresql_listen_port }}"
|
||||
|
||||
# Define variable for etcd
|
||||
etcd_hosts: []
|
||||
etcd_port: "2379"
|
||||
# patroni_postgresql_datadir: "/home/{{ patroni_scope }}"
|
||||
# patroni_postgresql_pgpass: "/tmp/{{ patroni_scope }}-pgpass"
|
||||
# patroni_postgresql_listen_ips: 127.0.0.1
|
||||
# patroni_postgresql_connect_ip: 127.0.0.1
|
||||
# patroni_postgresql_version: ''
|
||||
# patroni_postgresql_replication_user: 'repl'
|
||||
# patroni_postgresql_superuser: 'admin'
|
||||
|
||||
# # Each entry must look like this :
|
||||
# # { name: replication, user: foo, host: "1.2.3.4/32", hash_type: md5/scram-sha-256 }
|
||||
# patroni_postgresql_hba_roles: []
|
||||
|
||||
# # Define variable for etcd
|
||||
# etcd_hosts: []
|
||||
# etcd_port: "2379"
|
||||
#########################################################################
|
||||
|
||||
|
|
|
@ -1,19 +1,38 @@
|
|||
---
|
||||
#########################################################################
|
||||
# Disabled for now
|
||||
# It's too much work to completely manage a Patroni cluster from Ansible
|
||||
#########################################################################
|
||||
|
||||
|
||||
# - name: Create a password for PostgreSQL repl user
|
||||
# command: "apg -M LCN -n1 -m 16"
|
||||
# register: patroni_postgresql_replication_password
|
||||
# check_mode: no
|
||||
|
||||
# - name: Create a password for PostgreSQL superuser user
|
||||
# command: "apg -M LCN -n1 -m 16"
|
||||
# register: patroni_postgresql_superuser_password
|
||||
# check_mode: no
|
||||
|
||||
- name: Create a password for PostgreSQL repl user
|
||||
command: "apg -M LCN -n1 -m 16"
|
||||
local_action:
|
||||
module: ansible.builtin.command
|
||||
cmd: "apg -M LCN -n1 -m 16"
|
||||
register: patroni_postgresql_replication_password
|
||||
check_mode: no
|
||||
run_once: True
|
||||
|
||||
- name: Create a password for PostgreSQL superuser user
|
||||
command: "apg -M LCN -n1 -m 16"
|
||||
local_action:
|
||||
module: ansible.builtin.command
|
||||
cmd: "apg -M LCN -n1 -m 16"
|
||||
register: patroni_postgresql_superuser_password
|
||||
check_mode: no
|
||||
run_once: True
|
||||
|
||||
- name: Create Patroni config file
|
||||
ansible.builtin.template:
|
||||
src: config.j2
|
||||
dest: /etc/patroni/config.yml
|
||||
src: config.yml.j2
|
||||
dest: /etc/patroni/{{ patroni_scope }}.yml
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
|
@ -1,7 +1,14 @@
|
|||
---
|
||||
|
||||
- ansible.builtin.import_tasks: backports.yml
|
||||
when: patroni_backport | bool
|
||||
when: patroni_backport | bool | default(False)
|
||||
|
||||
- ansible.builtin.import_tasks: packages.yml
|
||||
- ansible.builtin.import_tasks: config.yml
|
||||
|
||||
|
||||
#########################################################################
|
||||
# Disabled for now
|
||||
# It's too much work to completely manage a Patroni cluster from Ansible
|
||||
##########
|
||||
# - ansible.builtin.import_tasks: config.yml
|
||||
#########################################################################
|
||||
|
|
|
@ -34,8 +34,8 @@ bootstrap:
|
|||
|
||||
pg_hba:
|
||||
- host replication repl 127.0.0.1/32 md5
|
||||
{% for server in groups['patroni'] %}
|
||||
- host replication repl {{ hostvars[server]['postgresql_hosts_cluster'] }}/0 md5
|
||||
{% for host in patroni_postgresql_replication_hosts %}
|
||||
- host {{ patroni_postgresql_replication_role }} {{ patroni_postgresql_replication_user }} {{ host }} {{ patroni_postgresql_replication_hash_type }}
|
||||
{% endfor %}
|
||||
- host all all 0.0.0.0/0 md5
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- name: Restart PgBouncer
|
||||
- name: restart pgbouncer
|
||||
ansible.builtin.systemd:
|
||||
name: pgbouncer.service
|
||||
state: restarted
|
||||
|
|
Loading…
Reference in a new issue