Skip to content

Commit 65f7b1f

Browse files
authored
Merge pull request vitabaks#274 from vitabaks/etcd-api-v3
update the etcd and vip-manager version (use API v3)
2 parents e12ba5a + ee30d76 commit 65f7b1f

File tree

8 files changed

+16
-19
lines changed

8 files changed

+16
-19
lines changed

roles/confd/templates/confd.toml.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
backend = "etcd"
1+
backend = "etcdv3"
22
interval = 10
33
watch = true
44
nodes = [

roles/etcd/tasks/main.yml

+6-8
Original file line numberDiff line numberDiff line change
@@ -116,21 +116,19 @@
116116

117117
- block:
118118
- name: Wait until the etcd cluster is healthy
119-
command: /usr/local/bin/etcdctl cluster-health
120-
environment:
121-
ETCDCTL_API: 2
119+
command: >
120+
/usr/local/bin/etcdctl endpoint health
121+
--endpoints=http://{{ inventory_hostname }}:2379
122122
register: etcd_health_result
123-
run_once: true
124-
changed_when: false
125-
until: "'cluster is healthy' in etcd_health_result.stdout"
123+
until: "'is healthy' in etcd_health_result.stdout"
126124
retries: 10
127125
delay: 10
126+
changed_when: false
128127
ignore_errors: false
129128

130129
- name: cluster health
131-
run_once: true
132130
debug:
133-
var: etcd_health_result.stdout_lines
131+
msg: "{{ etcd_health_result.stdout }}"
134132
tags: etcd, etcd_start, etcd_status
135133

136134
...

roles/etcd/templates/etcd.conf.j2

-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ ETCD_DATA_DIR="{{ etcd_data_dir }}"
1010
ETCD_ELECTION_TIMEOUT="5000"
1111
ETCD_HEARTBEAT_INTERVAL="1000"
1212
ETCD_INITIAL_ELECTION_TICK_ADVANCE="false"
13-
ETCD_ENABLE_V2="true"

roles/patroni/templates/patroni.yml.j2

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ restapi:
3030
# password: password
3131

3232
{% if not dcs_exists|bool and dcs_type == 'etcd' %}
33-
etcd:
33+
etcd3:
3434
hosts: {% for host in groups['etcd_cluster'] %}{{ hostvars[host]['inventory_hostname'] }}:2379{% if not loop.last %},{% endif %}{% endfor %}
3535
{% endif %}
3636
{% if dcs_exists|bool and dcs_type == 'etcd' %}
37-
etcd:
37+
etcd3:
3838
hosts: {% for etcd_hosts in patroni_etcd_hosts %}{{etcd_hosts.host}}:{{etcd_hosts.port}}{% if not loop.last %},{% endif %}{% endfor %}
3939
{% endif %}
4040

roles/vip-manager/handlers/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
- name: Wait for the cluster ip address (VIP) "{{ cluster_vip }}" is running
1212
wait_for:
1313
host: "{{ cluster_vip }}"
14-
port: "{{ ansible_ssh_port | default(22) }}"
14+
port: "{{ postgresql_port | default(5432) }}"
1515
state: started
1616
timeout: 60
1717
delay: 2

vars/Debian.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ postgresql_packages:
5858
# - postgresql-{{ postgresql_version }}-repack"
5959

6060
# Extra packages
61-
etcd_package_repo: "https://github.com/etcd-io/etcd/releases/download/{{ etcd_ver }}/etcd-{{ etcd_ver }}-linux-amd64.tar.gz"
62-
vip_manager_package_repo: "https://github.com/cybertec-postgresql/vip-manager/releases/download/v{{ vip_manager_version }}/vip-manager_{{ vip_manager_version }}-1_amd64.deb"
61+
etcd_package_repo: "https://github.com/etcd-io/etcd/releases/download/v{{ etcd_ver }}/etcd-v{{ etcd_ver }}-linux-amd64.tar.gz"
62+
vip_manager_package_repo: "https://github.com/cybertec-postgresql/vip-manager/releases/download/v{{ vip_manager_version }}/vip-manager_{{ vip_manager_version }}_Linux_x86_64.deb"
6363
# (if with_haproxy_load_balancing: true)
6464
haproxy_installation_method: "deb" # (default)"deb" or "src"
6565
haproxy_install_repo: true # or 'false'

vars/RedHat.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ postgresql_packages:
7979
# - pg_repack{{ postgresql_version_terse }}
8080

8181
# Extra packages
82-
etcd_package_repo: "https://github.com/etcd-io/etcd/releases/download/{{ etcd_ver }}/etcd-{{ etcd_ver }}-linux-amd64.tar.gz"
83-
vip_manager_package_repo: "https://github.com/cybertec-postgresql/vip-manager/releases/download/v{{ vip_manager_version }}/vip-manager-{{ vip_manager_version }}-1.x86_64.rpm"
82+
etcd_package_repo: "https://github.com/etcd-io/etcd/releases/download/v{{ etcd_ver }}/etcd-v{{ etcd_ver }}-linux-amd64.tar.gz"
83+
vip_manager_package_repo: "https://github.com/cybertec-postgresql/vip-manager/releases/download/v{{ vip_manager_version }}/vip-manager_{{ vip_manager_version }}_Linux_x86_64.rpm"
8484
# (if with_haproxy_load_balancing: true)
8585
haproxy_installation_method: "rpm" # (default)"rpm" or "src"
8686
haproxy_install_repo: true # or 'false' # only for RedHat/CentOS version 7.

vars/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ haproxy_timeout:
3939
server: "60m"
4040

4141
# vip-manager (if cluster_vip is specified and with_haproxy_load_balancing: false)
42-
vip_manager_version: "1.0.2" # version to install
42+
vip_manager_version: "2.1.0" # version to install
4343
vip_manager_conf: "/etc/patroni/vip-manager.yml"
4444
vip_manager_interval: "1000" # time (in milliseconds) after which vip-manager wakes up and checks if it needs to register or release ip addresses.
4545
vip_manager_iface: "{{ vip_interface }}" # interface to which the virtual ip will be added
@@ -52,7 +52,7 @@ dcs_exists: false # or 'true' if you don't want to deploy a new etcd cluster
5252
dcs_type: "etcd" # or 'consul'
5353

5454
# if dcs_type: "etcd" and dcs_exists: false
55-
etcd_ver: "v3.3.27" # version for deploy etcd cluster
55+
etcd_ver: "3.5.7" # version for deploy etcd cluster
5656
etcd_data_dir: "/var/lib/etcd"
5757
etcd_cluster_name: "etcd-{{ patroni_cluster_name }}" # ETCD_INITIAL_CLUSTER_TOKEN
5858

0 commit comments

Comments
 (0)