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.

28 lines
993 B

  1. ---
  2. - name: Configure | Check if member is in cluster
  3. shell: "etcdctl --peers={{ 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. when: is_etcd_master
  8. - name: Configure | Add member to the cluster if it is not there
  9. when: is_etcd_master and etcd_member_in_cluster.rc != 0 and etcd_cluster_is_healthy.rc == 0
  10. shell: "etcdctl --peers={{ etcd_access_addresses }} member add {{ etcd_member_name }} {{ etcd_peer_url }}"
  11. - name: Configure | Copy etcd.service systemd file
  12. template:
  13. src: etcd.service.j2
  14. dest: /etc/systemd/system/etcd.service
  15. backup: yes
  16. when: ansible_service_mgr == "systemd"
  17. notify: restart etcd
  18. - name: Configure | Write etcd initd script
  19. template:
  20. src: deb-etcd.initd.j2
  21. dest: /etc/init.d/etcd
  22. owner: root
  23. mode: 0755
  24. when: ansible_service_mgr in ["sysvinit","upstart"] and ansible_os_family == "Debian"
  25. notify: restart etcd