Compare commits
17 commits
stable
...
emorino/pa
Author | SHA1 | Date | |
---|---|---|---|
Jérémy Lecour | d83ae339d8 | ||
Jérémy Lecour | a3ec1d6712 | ||
Jérémy Lecour | 05da8f6472 | ||
Jérémy Lecour | 5cb3762080 | ||
Jérémy Lecour | 921e384358 | ||
Eric Morino | e27f0aa406 | ||
Eric Morino | d8e31ef297 | ||
Eric Morino | 26c927d3fe | ||
Eric Morino | 5028803dff | ||
Eric Morino | 63cb7a2671 | ||
Eric Morino | b4d5107025 | ||
Eric Morino | a66226ea95 | ||
Eric Morino | bc3f5409ef | ||
Eric Morino | e1c1966a6e | ||
Eric Morino | c13618b2e4 | ||
Eric Morino | 6db3769f9f | ||
Eric Morino | 96e24527ac |
|
@ -14,6 +14,7 @@ The **patch** part changes is incremented if multiple releases happen the same m
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
* graylog: new role
|
* graylog: new role
|
||||||
|
* Patroni: new role for install Patroni cluster
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
deb http://mirror.evolix.org/debian stretch-backports {{ apt_backports_components | mandatory }}
|
deb http://archive.debian.org/debian stretch-backports {{ apt_backports_components | mandatory }}
|
||||||
|
|
3
etcd/README.md
Normal file
3
etcd/README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# Etcd
|
||||||
|
|
||||||
|
Installation and basic configuration of etcd for integrate in a Patroni and PostgreSQL cluster.
|
12
etcd/defaults/main.yml
Normal file
12
etcd/defaults/main.yml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
# Define variable for etcd
|
||||||
|
etcd_listen_ip: []
|
||||||
|
etcd_cluster_ips: []
|
||||||
|
etcd_client_port: "2379"
|
||||||
|
etcd_peer_port: "2380"
|
||||||
|
etcd_local_name : ""
|
||||||
|
etcd_cluster_token : ""
|
||||||
|
etcd_datadir : "/var/lib/etcd/{{ etcd_cluster_token }}"
|
||||||
|
etcd_initial_cluster: ""
|
||||||
|
etcd_install_dependencies_for_patroni: False
|
6
etcd/handlers/main.yml
Normal file
6
etcd/handlers/main.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: restart etcd
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: etcd
|
||||||
|
state: restarted
|
20
etcd/tasks/config.yml
Normal file
20
etcd/tasks/config.yml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: etcd datadir is present
|
||||||
|
ansible.builtin.file:
|
||||||
|
name: "/var/lib/etcd/{{ etcd_cluster_token }}"
|
||||||
|
state: directory
|
||||||
|
owner: etcd
|
||||||
|
group: etcd
|
||||||
|
mode: "0700"
|
||||||
|
|
||||||
|
- name: etcd config file is present
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: etcd.j2
|
||||||
|
dest: /etc/default/etcd
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0644"
|
||||||
|
notify: restart etcd
|
||||||
|
|
||||||
|
|
4
etcd/tasks/main.yml
Normal file
4
etcd/tasks/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- ansible.builtin.import_tasks: packages.yml
|
||||||
|
- ansible.builtin.import_tasks: config.yml
|
15
etcd/tasks/packages.yml
Normal file
15
etcd/tasks/packages.yml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Install etcd client / server package
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name:
|
||||||
|
- 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
|
10
etcd/templates/etcd.j2
Normal file
10
etcd/templates/etcd.j2
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
ETCD_NAME="{{ etcd_local_name }}"
|
||||||
|
ETCD_DATA_DIR="{{ etcd_datadir }}"
|
||||||
|
ETCD_LOG_OUTPUTS="stdout"
|
||||||
|
ETCD_LISTEN_PEER_URLS="http://{{ etcd_listen_ip }}:{{ etcd_peer_port }}"
|
||||||
|
ETCD_LISTEN_CLIENT_URLS="http://localhost:{{ etcd_client_port }},http://{{ etcd_listen_ip }}:{{ etcd_client_port }}"
|
||||||
|
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://{{ etcd_listen_ip }}:{{ etcd_peer_port }}"
|
||||||
|
ETCD_INITIAL_CLUSTER="{{ etcd_initial_cluster }}"
|
||||||
|
ETCD_ADVERTISE_CLIENT_URLS="http://{{ etcd_listen_ip }}:{{ etcd_client_port }}"
|
||||||
|
ETCD_INITIAL_CLUSTER_TOKEN="{{ etcd_cluster_token }}"
|
||||||
|
ETCD_INITIAL_CLUSTER_STATE="new"
|
4
patroni/README.md
Normal file
4
patroni/README.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Patroni
|
||||||
|
|
||||||
|
Installation and basic configuration of Patroni.
|
||||||
|
|
51
patroni/defaults/main.yml
Normal file
51
patroni/defaults/main.yml
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
# Install Patroni from backport Evolix
|
||||||
|
patroni_backport: false
|
||||||
|
|
||||||
|
etcd_install_dependencies_for_patroni: True
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
# Disabled for now
|
||||||
|
# It's too much work to completely manage a Patroni cluster from Ansible
|
||||||
|
##########
|
||||||
|
# # Define variable for Patroni
|
||||||
|
|
||||||
|
# patroni_scope: "13-main"
|
||||||
|
# patroni_name: "{{ ansible_hostname }}"
|
||||||
|
|
||||||
|
# # 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_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_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_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"
|
||||||
|
#########################################################################
|
||||||
|
|
87
patroni/files/pub_evolix.asc
Normal file
87
patroni/files/pub_evolix.asc
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||||
|
|
||||||
|
mQINBGOsRdcBEADDPJ8Tsqr5Z4crmQlNQM32hfufe7gTUrXo0cAL8clt92y1QX3N
|
||||||
|
YyMv0Re4+Ugo7JZd4jsF2Q1twJMxsX5rA12xDnHHcZRSc/E0DIYvPnfLzEHkwseN
|
||||||
|
OK4f9lI+xo06k+B3KQQKMeI/RjVaN6AiSply9ZGaZVeGGqd4es4PsU1VQMTWdclV
|
||||||
|
Bn54HBWUnL5dPStPMnNkt0bMQYIqc5733Yby3qMiUKcql2bl9TYBw8SaJXvClsLw
|
||||||
|
ERqit6FjljUOEeWtB4WZFpjhc/aqcxGcUTPHRrNTlNF0HCvk8JicEu4/lr99pwy7
|
||||||
|
7z6SRql++WGMSG06E4MBtUt+wWAmDDHNj3fdZPnoCaDFp7vxy/FEARB2aygTtu11
|
||||||
|
mLk4XOKheqU/WibWxoXRzyUCuclJ247Fh+YPxkYVG1dnDwpWGbYuRmzUapGLv4ma
|
||||||
|
dnKsQN0KhXzUqkSoybBgV208dGOP7BqdY6TVnyU0v/7XDeUqFEwnllRKMSYLilV3
|
||||||
|
huTifiCFTK45HACM/x2yckx8dyAuYg6cJaAR1yn1iaTexoyYPG9ZFifvMB6ranEm
|
||||||
|
vkmQq1e8/7xiNSQsh5F3Ybl5hh4GVLwsR6esfZsHG0Ve+CitsmcZgWnr0JJ2PZOk
|
||||||
|
+XHxMwo7Gb0/KVH9XGeoXk+eiNNW/kdcgBMkGkU3nWooVHDm7Dy54I5CzQARAQAB
|
||||||
|
tC9Fdm9saXggUHVibGljIFJlcG9zaXRvcnkgPGVxdWlwZStwdWJAZXZvbGl4LmZy
|
||||||
|
PokCVAQTAQoAPhYhBP+vfRvzUK1F+rMpCUaPWta4YwY9BQJjrEXXAhsDBQkHhM4A
|
||||||
|
BQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEEaPWta4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lHc7uF0caYGMkqRNHiX17d5EtaidTbiqQii1W9slSPXmUuUcKfD1xUfLng7TbZVm
|
||||||
|
AdEbpHCT+q037cGCYFpHPMvw3OYhhGzYeh3+1oN9t3ZvyGlvAhkrtssDQB+gxX8r
|
||||||
|
adCpihziFLjm+6IvCLYHEh3gILVFbbhdYDDUduFFjf/snlJW7j8OVc7Cxa7FbPdf
|
||||||
|
SHLT9VESzf7oiwkP5/ijGmHiEQoJd9EWYkGGz+LZAXemBwe5ZnPPWVZvDEQRMe8v
|
||||||
|
2V8pa37vyReaK//O8xxGg3NzGTn9otwVr/4Ti9OxrSzmDWpd967oZ42IZSeSY2bz
|
||||||
|
kOaV8z4C8AIgIA7vWOS83Hncbrgf2nMCXmRjf0KTMm1P7Z0BQDWpxK9lP0nRpVAg
|
||||||
|
2T3/OjJ9KcAsTz02NFC3/kOUz//NcfDP747HsQB0sltIty140B7CfcWk0a0eKSad
|
||||||
|
OxGUehskjyKhO6v3dYF+8oR9p98Q8/Rh8r7evYy2mfhgJd7a9Cchn7612Y6k1SLf
|
||||||
|
nmPGYu3s0lf/k6GoHLfXXQIJDgWeua4ZBr6cgpGONLSvWBeCVaqnk8nhbNIiSBHk
|
||||||
|
jnrcX8xAtoPLgqg0+yi7rZ3NAauZcQE6UaNB+xjJxDOIpgVLUWtFyAG4MDeIh6GH
|
||||||
|
oA9QflpnDubMnCve
|
||||||
|
=ZCml
|
||||||
|
-----END PGP PUBLIC KEY BLOCK-----
|
31
patroni/meta/main.yml
Normal file
31
patroni/meta/main.yml
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
galaxy_info:
|
||||||
|
company: Evolix
|
||||||
|
description: Installation and basic configuration of Patroni
|
||||||
|
|
||||||
|
issue_tracker_url: https://gitea.evolix.org/evolix/ansible-roles/issues
|
||||||
|
|
||||||
|
license: GPLv2
|
||||||
|
|
||||||
|
min_ansible_version: "2.7"
|
||||||
|
|
||||||
|
platforms:
|
||||||
|
- name: Debian
|
||||||
|
versions:
|
||||||
|
- buster
|
||||||
|
- bullseye
|
||||||
|
- bookworm
|
||||||
|
|
||||||
|
galaxy_tags: []
|
||||||
|
# List tags for your role here, one per line. A tag is
|
||||||
|
# a keyword that describes and categorizes the role.
|
||||||
|
# Users find roles by searching for tags. Be sure to
|
||||||
|
# remove the '[]' above if you add tags to this list.
|
||||||
|
#
|
||||||
|
# NOTE: A tag is limited to a single word comprised of
|
||||||
|
# alphanumeric characters. Maximum 20 tags per role.
|
||||||
|
|
||||||
|
dependencies: []
|
||||||
|
# List your role dependencies here, one per line.
|
||||||
|
# Be sure to remove the '[]' above if you add dependencies
|
||||||
|
# to this list.
|
||||||
|
|
27
patroni/tasks/backports.yml
Normal file
27
patroni/tasks/backports.yml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Add Evolix GPG key
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: pub_evolix.asc
|
||||||
|
dest: "{{ apt_keyring_dir }}/pub_evolix.asc"
|
||||||
|
force: yes
|
||||||
|
mode: "0644"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
|
||||||
|
- name: Add Evolix backports repository
|
||||||
|
ansible.builtin.apt_repository:
|
||||||
|
repo: "deb [signed-by={{ apt_keyring_dir }}/pub_evolix.asc] http://pub.evolix.org/evolix {{ ansible_distribution_release }}-backports main"
|
||||||
|
filename: backports.list
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Update APT cache
|
||||||
|
ansible.builtin.apt:
|
||||||
|
update_cache: yes
|
||||||
|
|
||||||
|
- name: Add APT preference file
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: patroni.pref.j2
|
||||||
|
dest: /etc/apt/preferences.d/patroni.pref
|
||||||
|
mode: "0644"
|
||||||
|
|
38
patroni/tasks/config.yml
Normal file
38
patroni/tasks/config.yml
Normal file
|
@ -0,0 +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
|
||||||
|
local_action:
|
||||||
|
module: ansible.builtin.command
|
||||||
|
cmd: "apg -M LCN -n1 -m 16"
|
||||||
|
register: patroni_postgresql_replication_password
|
||||||
|
run_once: True
|
||||||
|
|
||||||
|
- name: Create a password for PostgreSQL superuser user
|
||||||
|
local_action:
|
||||||
|
module: ansible.builtin.command
|
||||||
|
cmd: "apg -M LCN -n1 -m 16"
|
||||||
|
register: patroni_postgresql_superuser_password
|
||||||
|
run_once: True
|
||||||
|
|
||||||
|
- name: Create Patroni config file
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: config.yml.j2
|
||||||
|
dest: /etc/patroni/{{ patroni_scope }}.yml
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0644"
|
14
patroni/tasks/main.yml
Normal file
14
patroni/tasks/main.yml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- ansible.builtin.import_tasks: backports.yml
|
||||||
|
when: patroni_backport | bool | default(False)
|
||||||
|
|
||||||
|
- ansible.builtin.import_tasks: packages.yml
|
||||||
|
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
# Disabled for now
|
||||||
|
# It's too much work to completely manage a Patroni cluster from Ansible
|
||||||
|
##########
|
||||||
|
# - ansible.builtin.import_tasks: config.yml
|
||||||
|
#########################################################################
|
8
patroni/tasks/packages.yml
Normal file
8
patroni/tasks/packages.yml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Install patroni package
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name:
|
||||||
|
- patroni
|
||||||
|
update_cache: yes
|
||||||
|
|
73
patroni/templates/config.yml.j2
Normal file
73
patroni/templates/config.yml.j2
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
scope: {{ patroni_scope }}
|
||||||
|
name: {{ patroni_name }}
|
||||||
|
|
||||||
|
restapi:
|
||||||
|
listen: {{ patroni_restapi_listen }}
|
||||||
|
connect_address: {{ patroni_restapi_connect_address }}
|
||||||
|
|
||||||
|
etcd:
|
||||||
|
hosts:
|
||||||
|
{% for server in groups['etcd'] %}
|
||||||
|
- {{ hostvars[server]['etcd_host'] }}:{{ etcd_client_port }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
bootstrap:
|
||||||
|
dcs:
|
||||||
|
ttl: 30
|
||||||
|
loop_wait: 10
|
||||||
|
retry_timeout: 10
|
||||||
|
maximum_lag_on_failover: 1048576
|
||||||
|
postgresql:
|
||||||
|
use_pg_rewind: true
|
||||||
|
use_slots: true
|
||||||
|
parameters:
|
||||||
|
wal_level: replica
|
||||||
|
hot_standby: "on"
|
||||||
|
wal_keep_segment: 8
|
||||||
|
max_wal_senders: 5
|
||||||
|
max_relication_slots: 5
|
||||||
|
checkpoint_timeout: 30
|
||||||
|
|
||||||
|
initdb:
|
||||||
|
- encoding: UTF8
|
||||||
|
- data-checksums
|
||||||
|
|
||||||
|
pg_hba:
|
||||||
|
- host replication repl 127.0.0.1/32 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
|
||||||
|
|
||||||
|
users:
|
||||||
|
{{ patroni_postgresql_superuser }}:
|
||||||
|
password: {{ patroni_postgresql_superuser_password.stdout }}
|
||||||
|
options:
|
||||||
|
- createrole
|
||||||
|
- createdb
|
||||||
|
{{ patroni_postgresql_replication_user }}:
|
||||||
|
password: {{ patroni_postgresql_replication_password.stdout }}
|
||||||
|
options:
|
||||||
|
- replication
|
||||||
|
|
||||||
|
postgresql:
|
||||||
|
listen: {{ patroni_postgresql_listen }}
|
||||||
|
connect_address: {{ patroni_postgresql_connect_address }}
|
||||||
|
bin_dir: /usr/lib/postgresql/{{ patroni_postgresql_version }}/bin/
|
||||||
|
data_dir: {{ patroni_postgresql_datadir }}
|
||||||
|
pgpass: {{ patroni_postgresql_pgpass }}
|
||||||
|
authentication:
|
||||||
|
replication:
|
||||||
|
username: {{ patroni_postgresql_replication_user }}
|
||||||
|
password: {{ patroni_postgresql_replication_password.stdout }}
|
||||||
|
superuser:
|
||||||
|
username: {{ patroni_postgresql_superuser }}
|
||||||
|
password: {{ patroni_postgresql_superuser_password.stdout }}
|
||||||
|
parameters:
|
||||||
|
unix_socket_directories: '/tmp'
|
||||||
|
|
||||||
|
tags:
|
||||||
|
nofailover: false
|
||||||
|
noloadbalance: false
|
||||||
|
clonefrom: false
|
||||||
|
nosync: false
|
3
patroni/templates/patroni.pref.j2
Normal file
3
patroni/templates/patroni.pref.j2
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Package: patroni
|
||||||
|
Pin: release a={{ ansible_distribution_release }}-backports
|
||||||
|
Pin-Priority: 999
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
- name: Restart PgBouncer
|
- name: restart pgbouncer
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: pgbouncer.service
|
name: pgbouncer.service
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
Loading…
Reference in a new issue