Skip to content

Commit

Permalink
Merge pull request #274 from vitabaks/etcd-api-v3
Browse files Browse the repository at this point in the history
update the etcd and vip-manager version (use API v3)
  • Loading branch information
vitabaks authored Mar 4, 2023
2 parents e12ba5a + ee30d76 commit 65f7b1f
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion roles/confd/templates/confd.toml.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
backend = "etcd"
backend = "etcdv3"
interval = 10
watch = true
nodes = [
Expand Down
14 changes: 6 additions & 8 deletions roles/etcd/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,19 @@

- block:
- name: Wait until the etcd cluster is healthy
command: /usr/local/bin/etcdctl cluster-health
environment:
ETCDCTL_API: 2
command: >
/usr/local/bin/etcdctl endpoint health
--endpoints=http://{{ inventory_hostname }}:2379
register: etcd_health_result
run_once: true
changed_when: false
until: "'cluster is healthy' in etcd_health_result.stdout"
until: "'is healthy' in etcd_health_result.stdout"
retries: 10
delay: 10
changed_when: false
ignore_errors: false

- name: cluster health
run_once: true
debug:
var: etcd_health_result.stdout_lines
msg: "{{ etcd_health_result.stdout }}"
tags: etcd, etcd_start, etcd_status

...
1 change: 0 additions & 1 deletion roles/etcd/templates/etcd.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ ETCD_DATA_DIR="{{ etcd_data_dir }}"
ETCD_ELECTION_TIMEOUT="5000"
ETCD_HEARTBEAT_INTERVAL="1000"
ETCD_INITIAL_ELECTION_TICK_ADVANCE="false"
ETCD_ENABLE_V2="true"
4 changes: 2 additions & 2 deletions roles/patroni/templates/patroni.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ restapi:
# password: password

{% if not dcs_exists|bool and dcs_type == 'etcd' %}
etcd:
etcd3:
hosts: {% for host in groups['etcd_cluster'] %}{{ hostvars[host]['inventory_hostname'] }}:2379{% if not loop.last %},{% endif %}{% endfor %}
{% endif %}
{% if dcs_exists|bool and dcs_type == 'etcd' %}
etcd:
etcd3:
hosts: {% for etcd_hosts in patroni_etcd_hosts %}{{etcd_hosts.host}}:{{etcd_hosts.port}}{% if not loop.last %},{% endif %}{% endfor %}
{% endif %}

Expand Down
2 changes: 1 addition & 1 deletion roles/vip-manager/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
- name: Wait for the cluster ip address (VIP) "{{ cluster_vip }}" is running
wait_for:
host: "{{ cluster_vip }}"
port: "{{ ansible_ssh_port | default(22) }}"
port: "{{ postgresql_port | default(5432) }}"
state: started
timeout: 60
delay: 2
Expand Down
4 changes: 2 additions & 2 deletions vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ postgresql_packages:
# - postgresql-{{ postgresql_version }}-repack"

# Extra packages
etcd_package_repo: "https://github.com/etcd-io/etcd/releases/download/{{ etcd_ver }}/etcd-{{ etcd_ver }}-linux-amd64.tar.gz"
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"
etcd_package_repo: "https://github.com/etcd-io/etcd/releases/download/v{{ etcd_ver }}/etcd-v{{ etcd_ver }}-linux-amd64.tar.gz"
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"
# (if with_haproxy_load_balancing: true)
haproxy_installation_method: "deb" # (default)"deb" or "src"
haproxy_install_repo: true # or 'false'
Expand Down
4 changes: 2 additions & 2 deletions vars/RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ postgresql_packages:
# - pg_repack{{ postgresql_version_terse }}

# Extra packages
etcd_package_repo: "https://github.com/etcd-io/etcd/releases/download/{{ etcd_ver }}/etcd-{{ etcd_ver }}-linux-amd64.tar.gz"
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"
etcd_package_repo: "https://github.com/etcd-io/etcd/releases/download/v{{ etcd_ver }}/etcd-v{{ etcd_ver }}-linux-amd64.tar.gz"
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"
# (if with_haproxy_load_balancing: true)
haproxy_installation_method: "rpm" # (default)"rpm" or "src"
haproxy_install_repo: true # or 'false' # only for RedHat/CentOS version 7.
Expand Down
4 changes: 2 additions & 2 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ haproxy_timeout:
server: "60m"

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

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

Expand Down

0 comments on commit 65f7b1f

Please sign in to comment.