Compare commits
8 commits
Author | SHA1 | Date | |
---|---|---|---|
a31b868599 | |||
Eric Morino | 7eb4bda74f | ||
Eric Morino | 6f68d17b95 | ||
Eric Morino | 953c7fc48f | ||
Eric Morino | 7978edc7b2 | ||
Eric Morino | c930563ce8 | ||
Eric Morino | 851c2ab575 | ||
Eric Morino | 49cd3fb5b0 |
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
|
||||
patroni_install_dependencies: "True"
|
||||
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: ""
|
19
etcd/tasks/config.yml
Normal file
19
etcd/tasks/config.yml
Normal file
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
|
||||
- name: Create etcd config file
|
||||
ansible.builtin.template:
|
||||
src: etcd.j2
|
||||
dest: /etc/default/etcd
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Create etcd datadir
|
||||
ansible.builtin.file:
|
||||
name: "/var/lib/etcd/{{ etcd_cluster_token }}"
|
||||
state: directory
|
||||
owner: etcd
|
||||
group: etcd
|
||||
mode: "0700"
|
||||
|
||||
|
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: patroni_install_dependencies | 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,4 +4,4 @@
|
|||
when: patroni_backport | bool
|
||||
|
||||
- ansible.builtin.import_tasks: packages.yml
|
||||
- ansible.builtin.import_tasks: config.yml
|
||||
#- ansible.builtin.import_tasks: config.yml
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
scope: {{ cluster_name }}
|
||||
name: {{ cluster_name_host }}
|
||||
name: {{ inventory_hostname }}
|
||||
|
||||
restapi:
|
||||
listen: {{ patroni_restapi_listen }}:{{ patroni_restapi_port }}
|
||||
|
@ -33,11 +33,11 @@ bootstrap:
|
|||
- data-checksums
|
||||
|
||||
pg_hba:
|
||||
- host replication repl 127.0.0.1/32 md5
|
||||
- host replication repl 127.0.0.1/32 scram-sha-256
|
||||
{% for server in groups['patroni'] %}
|
||||
- host replication repl {{ hostvars[server]['postgresql_hosts_cluster'] }}/0 md5
|
||||
- host replication repl {{ hostvars[server]['postgresql_hosts_cluster'] }}/0 scram-sha-256
|
||||
{% endfor %}
|
||||
- host all all 0.0.0.0/0 md5
|
||||
- host all all 0.0.0.0/0 scram-sha-256
|
||||
|
||||
users:
|
||||
{{ postgresql_superuser }}:
|
||||
|
@ -53,9 +53,9 @@ bootstrap:
|
|||
postgresql:
|
||||
listen: {{ postgresql_host }}:{{ postgresql_port }}
|
||||
connect_address: {{ postgresql_host }}:{{ postgresql_port }}
|
||||
bin_dir: /var/lib/postgresql/{{ postgresql_version }}/bin/
|
||||
data_dir: /home/{{ cluster_name_host }}
|
||||
pgpass: /tmp/{{ cluster_name_host }}-pgpass
|
||||
bin_dir: /usr/lib/postgresql/{{ postgresql_version }}/bin/
|
||||
data_dir: /srv/{{ cluster_name }}
|
||||
pgpass: /tmp/{{ cluster_name }}-pgpass
|
||||
authentication:
|
||||
replication:
|
||||
username: {{ postgresql_replication_user }}
|
||||
|
|
Loading…
Reference in a new issue