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.

30 lines
1.0 KiB

  1. ---
  2. - name: Configure | Check if member is in cluster
  3. shell: "{{ bin_dir }}/etcdctl --no-sync --endpoints={{ etcd_access_addresses }} member list | grep -q {{ etcd_access_address }}"
  4. register: etcd_member_in_cluster
  5. ignore_errors: true
  6. changed_when: false
  7. check_mode: no
  8. when: is_etcd_master
  9. tags:
  10. - facts
  11. environment:
  12. ETCDCTL_CERT_FILE: "{{ etcd_cert_dir }}/node-{{ inventory_hostname }}.pem"
  13. ETCDCTL_KEY_FILE: "{{ etcd_cert_dir }}/node-{{ inventory_hostname }}-key.pem"
  14. - name: Configure | Copy etcd.service systemd file
  15. template:
  16. src: "etcd-{{ etcd_deployment_type }}.service.j2"
  17. dest: /etc/systemd/system/etcd.service
  18. backup: yes
  19. when: is_etcd_master
  20. notify: restart etcd
  21. - name: Configure | Join member(s) to cluster one at a time
  22. include_tasks: join_member.yml
  23. vars:
  24. target_node: "{{ item }}"
  25. loop_control:
  26. pause: 10
  27. with_items: "{{ groups['etcd'] }}"
  28. when: inventory_hostname == item and etcd_member_in_cluster.rc != 0 and etcd_cluster_is_healthy.rc == 0