diff --git a/roles/etcd/handlers/main.yml b/roles/etcd/handlers/main.yml index 62c56dee8..b1123f530 100644 --- a/roles/etcd/handlers/main.yml +++ b/roles/etcd/handlers/main.yml @@ -2,26 +2,25 @@ - name: Backup etcd import_tasks: backup.yml -- name: Etcd | reload systemd +- name: Restart etcd systemd_service: - daemon_reload: true - listen: - - Restart etcd - - Restart etcd-events - -- name: Reload etcd - service: name: etcd state: restarted + daemon_reload: true when: ('etcd' in group_names) - listen: Restart etcd + throttle: "{{ groups['etcd'] | length // 2 }}" + # Etcd cluster MUST have an odd number of members + # Truncated integer division by 2 will always return (majority - 1) which + # means the cluster will keep quorum and stay available -- name: Reload etcd-events - service: +- name: Restart etcd-events + systemd_service: name: etcd-events state: restarted + daemon_reload: true + # TODO: this seems odd. etcd-events should be a different group possibly ? when: ('etcd' in group_names) - listen: Restart etcd-events + throttle: "{{ groups['etcd'] | length // 2 }}" - name: Wait for etcd up uri: