2018-03-01 08:39:14 +00:00
|
|
|
---
|
2020-07-27 13:24:17 +00:00
|
|
|
- name: Join Member | Add member to etcd-events cluster # noqa 301 305
|
2020-07-20 14:26:51 +00:00
|
|
|
shell: "{{ bin_dir }}/etcdctl member add {{ etcd_member_name }} --peer-urls={{ etcd_events_peer_url }}"
|
2018-03-01 08:39:14 +00:00
|
|
|
register: member_add_result
|
|
|
|
until: member_add_result.rc == 0
|
2020-02-11 09:38:01 +00:00
|
|
|
retries: "{{ etcd_retries }}"
|
2018-03-01 08:39:14 +00:00
|
|
|
delay: "{{ retry_stagger | random + 3 }}"
|
|
|
|
environment:
|
2020-07-20 14:26:51 +00:00
|
|
|
ETCDCTL_API: 3
|
|
|
|
ETCDCTL_CERT: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem"
|
|
|
|
ETCDCTL_KEY: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem"
|
|
|
|
ETCDCTL_CACERT: "{{ etcd_cert_dir }}/ca.pem"
|
2020-07-01 11:56:16 +00:00
|
|
|
ETCDCTL_ENDPOINTS: "{{ etcd_events_access_addresses }}"
|
2018-03-01 08:39:14 +00:00
|
|
|
|
|
|
|
- include_tasks: refresh_config.yml
|
|
|
|
vars:
|
|
|
|
etcd_events_peer_addresses: >-
|
|
|
|
{% for host in groups['etcd'] -%}
|
|
|
|
{%- if hostvars[host]['etcd_events_member_in_cluster'].rc == 0 -%}
|
2020-12-02 21:55:00 +00:00
|
|
|
{{ "etcd"+loop.index|string }}=https://{{ hostvars[host].etcd_events_access_address | default(hostvars[host].ip | default(fallback_ips[host])) }}:2382,
|
2018-03-01 08:39:14 +00:00
|
|
|
{%- endif -%}
|
|
|
|
{%- if loop.last -%}
|
|
|
|
{{ etcd_member_name }}={{ etcd_events_peer_url }}
|
|
|
|
{%- endif -%}
|
|
|
|
{%- endfor -%}
|
|
|
|
|
2020-08-31 10:20:20 +00:00
|
|
|
- name: Join Member | Ensure member is in etcd-events cluster
|
|
|
|
shell: "set -o pipefail && {{ bin_dir }}/etcdctl member list | grep -q {{ etcd_events_access_address }}"
|
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
2018-03-01 08:39:14 +00:00
|
|
|
register: etcd_events_member_in_cluster
|
|
|
|
changed_when: false
|
|
|
|
check_mode: no
|
|
|
|
tags:
|
|
|
|
- facts
|
|
|
|
environment:
|
2020-07-20 14:26:51 +00:00
|
|
|
ETCDCTL_API: 3
|
|
|
|
ETCDCTL_CERT: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem"
|
|
|
|
ETCDCTL_KEY: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem"
|
|
|
|
ETCDCTL_CACERT: "{{ etcd_cert_dir }}/ca.pem"
|
2020-07-01 11:56:16 +00:00
|
|
|
ETCDCTL_ENDPOINTS: "{{ etcd_events_access_addresses }}"
|
2020-04-08 08:27:43 +00:00
|
|
|
|
|
|
|
- name: Configure | Ensure etcd-events is running
|
|
|
|
service:
|
|
|
|
name: etcd-events
|
|
|
|
state: started
|
|
|
|
enabled: yes
|