création role etcd
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2797|0|2797|0|:zzz: Details
gitea/ansible-roles/pipeline/head This commit looks good Details

This commit is contained in:
Eric Morino 2023-04-03 16:04:50 +02:00
parent 8ec5c79ca1
commit 49cd3fb5b0
5 changed files with 49 additions and 0 deletions

3
etcd/README.md Normal file
View File

@ -0,0 +1,3 @@
# Etcd
Installation and basic configuration of etcd for integrate in a Patroni and PostgreSQL cluster.

11
etcd/defaults/main.yml Normal file
View File

@ -0,0 +1,11 @@
---
# 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: ""

10
etcd/tasks/config.yml Normal file
View File

@ -0,0 +1,10 @@
---
- name: Create etcd config file
ansible.builtin.template:
src: etcd.j2
dest: /etc/default/etcd
owner: root
group: root
mode: "0644"

15
etcd/tasks/packages.yml Normal file
View 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
View 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_peer_hosts }}:{{ 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_local_name }}=http://{{ etcd_cluster_ips }}:{{ etcd_peer_port }},"
ETCD_ADVERTISE_CLIENT_URLS="http://{{ etcd_listen_ip }}:{{ etcd_client_port }}"
ETCD_INITIAL_CLUSTER_TOKEN="{{ etcd_cluster_token }}"
ETCD_INITIAL_CLUSTER_STATE="new"