WIP: use the systemd unit and config conventions of Patroni 3
This commit is contained in:
parent
921e384358
commit
5cb3762080
|
@ -2,25 +2,18 @@
|
|||
|
||||
- name: Create a password for PostgreSQL repl user
|
||||
command: "apg -M LCN -n1 -m 16"
|
||||
register: postgresql_replication_password
|
||||
register: patroni_postgresql_replication_password
|
||||
check_mode: no
|
||||
|
||||
- name: Create a password for PostgreSQL superuser user
|
||||
command: "apg -M LCN -n1 -m 16"
|
||||
register: postgresql_superuser_password
|
||||
register: patroni_postgresql_superuser_password
|
||||
check_mode: no
|
||||
|
||||
- name: Create Patroni config file
|
||||
ansible.builtin.template:
|
||||
src: patroni.conf.j2
|
||||
dest: /etc/patroni/config-{{ cluster_name }}.yml
|
||||
src: config.j2
|
||||
dest: /etc/patroni/config.yml
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- mane: Create Systemd Unit for Patroni
|
||||
ansible.builtin.template:
|
||||
src: patroni.service.j2
|
||||
dest: /etc/systemd/system/patroni.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
mode: "0644"
|
|
@ -1,9 +1,9 @@
|
|||
scope: {{ cluster_name }}
|
||||
name: {{ cluster_name_host }}
|
||||
scope: {{ patroni_scope }}
|
||||
name: {{ patroni_name }}
|
||||
|
||||
restapi:
|
||||
listen: {{ patroni_restapi_listen }}:{{ patroni_restapi_port }}
|
||||
connect_address: {{ patroni_restapi_listen }}:{{ patroni_restapi_port }}
|
||||
listen: {{ patroni_restapi_listen }}
|
||||
connect_address: {{ patroni_restapi_connect_address }}
|
||||
|
||||
etcd:
|
||||
hosts:
|
||||
|
@ -40,29 +40,29 @@ bootstrap:
|
|||
- host all all 0.0.0.0/0 md5
|
||||
|
||||
users:
|
||||
{{ postgresql_superuser }}:
|
||||
password: {{ postgresql_superuser_password.stdout }}
|
||||
{{ patroni_postgresql_superuser }}:
|
||||
password: {{ patroni_postgresql_superuser_password.stdout }}
|
||||
options:
|
||||
- createrole
|
||||
- createdb
|
||||
{{ postgresql_replication_user }}:
|
||||
password: {{ postgresql_replication_password.stdout }}
|
||||
{{ patroni_postgresql_replication_user }}:
|
||||
password: {{ patroni_postgresql_replication_password.stdout }}
|
||||
options:
|
||||
- replication
|
||||
|
||||
postgresql:
|
||||
listen: {{ postgresql_listen_ips }}:{{ postgresql_port }}
|
||||
connect_address: {{ postgresql_connect_ip }}:{{ postgresql_port }}
|
||||
bin_dir: /usr/lib/postgresql/{{ postgresql_version }}/bin/
|
||||
data_dir: /home/{{ cluster_name_host }}
|
||||
pgpass: /tmp/{{ cluster_name_host }}-pgpass
|
||||
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: {{ postgresql_replication_user }}
|
||||
password: {{ postgresql_replication_password.stdout }}
|
||||
username: {{ patroni_postgresql_replication_user }}
|
||||
password: {{ patroni_postgresql_replication_password.stdout }}
|
||||
superuser:
|
||||
username: {{ postgresql_superuser }}
|
||||
password: {{ postgresql_superuser_password.stdout }}
|
||||
username: {{ patroni_postgresql_superuser }}
|
||||
password: {{ patroni_postgresql_superuser_password.stdout }}
|
||||
parameters:
|
||||
unix_socket_directories: '/tmp'
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
[Unit]
|
||||
Description=Runners to orchestrate a high-availability PostgreSQL
|
||||
After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
||||
User=postgres
|
||||
Group=postgres
|
||||
|
||||
ExecStart=/usr/bin/patroni /etc/patroni/config-{{ cluster_name }}.yml
|
||||
KillMode=process
|
||||
TimeoutSec=30
|
||||
Restart=no
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.targ
|
Loading…
Reference in a new issue