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.

39 lines
1.2 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: Install etcd launch script
  15. template:
  16. src: etcd.j2
  17. dest: "{{ bin_dir }}/etcd"
  18. owner: 'root'
  19. mode: 0755
  20. backup: yes
  21. notify: restart etcd
  22. - name: Configure | Copy etcd.service systemd file
  23. template:
  24. src: "etcd-{{ etcd_deployment_type }}.service.j2"
  25. dest: /etc/systemd/system/etcd.service
  26. backup: yes
  27. when: is_etcd_master
  28. notify: restart etcd
  29. - name: Configure | Join member(s) to cluster one at a time
  30. include_tasks: join_member.yml
  31. vars:
  32. target_node: "{{ item }}"
  33. loop_control:
  34. pause: 10
  35. with_items: "{{ groups['etcd'] }}"
  36. when: inventory_hostname == item and etcd_member_in_cluster.rc != 0 and etcd_cluster_is_healthy.rc == 0