add_new_member.yml 786 B

1234567891011121314151617181920
  1. ---
  2. # Set some facts to reference from hostvars
  3. - import_tasks: set_facts.yml
  4. - name: Add new etcd members to cluster
  5. command: >
  6. {{ r_etcd_common_etcdctl_command }}
  7. --cert-file {{ etcd_peer_cert_file }}
  8. --key-file {{ etcd_peer_key_file }}
  9. --ca-file {{ etcd_peer_ca_file }}
  10. -C {{ etcd_peer_url_scheme }}://{{ hostvars[etcd_ca_host].etcd_ip }}:{{ etcd_client_port }}
  11. member add {{ etcd_hostname }} {{ etcd_peer_url_scheme }}://{{ etcd_ip }}:{{ etcd_peer_port }}
  12. delegate_to: "{{ etcd_ca_host }}"
  13. failed_when:
  14. - etcd_add_check.rc == 1
  15. - ("peerURL exists" not in etcd_add_check.stderr)
  16. register: etcd_add_check
  17. retries: 3
  18. delay: 10
  19. until: etcd_add_check.rc == 0