You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.8 KiB

  1. ---
  2. - name: Join Member | Add member to etcd-events cluster # noqa 301 305
  3. shell: "{{ bin_dir }}/etcdctl member add {{ etcd_member_name }} --peer-urls={{ etcd_events_peer_url }}"
  4. register: member_add_result
  5. until: member_add_result.rc == 0
  6. retries: "{{ etcd_retries }}"
  7. delay: "{{ retry_stagger | random + 3 }}"
  8. environment:
  9. ETCDCTL_API: 3
  10. ETCDCTL_CERT: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem"
  11. ETCDCTL_KEY: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem"
  12. ETCDCTL_CACERT: "{{ etcd_cert_dir }}/ca.pem"
  13. ETCDCTL_ENDPOINTS: "{{ etcd_events_access_addresses }}"
  14. - include_tasks: refresh_config.yml
  15. vars:
  16. etcd_events_peer_addresses: >-
  17. {% for host in groups['etcd'] -%}
  18. {%- if hostvars[host]['etcd_events_member_in_cluster'].rc == 0 -%}
  19. {{ "etcd"+loop.index|string }}=https://{{ hostvars[host].access_ip | default(hostvars[host].ip | default(fallback_ips[host])) }}:2382,
  20. {%- endif -%}
  21. {%- if loop.last -%}
  22. {{ etcd_member_name }}={{ etcd_events_peer_url }}
  23. {%- endif -%}
  24. {%- endfor -%}
  25. - name: Join Member | Ensure member is in etcd-events cluster
  26. shell: "set -o pipefail && {{ bin_dir }}/etcdctl member list | grep -q {{ etcd_events_access_address }}"
  27. args:
  28. executable: /bin/bash
  29. register: etcd_events_member_in_cluster
  30. changed_when: false
  31. check_mode: no
  32. tags:
  33. - facts
  34. environment:
  35. ETCDCTL_API: 3
  36. ETCDCTL_CERT: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem"
  37. ETCDCTL_KEY: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem"
  38. ETCDCTL_CACERT: "{{ etcd_cert_dir }}/ca.pem"
  39. ETCDCTL_ENDPOINTS: "{{ etcd_events_access_addresses }}"
  40. - name: Configure | Ensure etcd-events is running
  41. service:
  42. name: etcd-events
  43. state: started
  44. enabled: yes