Etcd cluster setup makeover

The current way to setup the etc cluster is messy and buggy.

- It checks for cluster is healthy before the cluster is even created.
- The unit files are started on handlers, not in the task, so you mess with "flush handlers".
- The join_member.yml is not used.
- etcd events cluster is not configured for kubeadm
- remove duplicate runs between running the role on etcd nodes and k8s nodes
This commit is contained in:
woopstar
2018-04-01 18:58:08 +02:00
committed by Andreas Kruger
parent 92fc2df214
commit 86e3506ae6
15 changed files with 135 additions and 172 deletions

View File

@@ -6,6 +6,7 @@
- facts
- include_tasks: "gen_certs_{{ cert_management }}.yml"
when:
tags:
- etcd-secrets
@@ -29,47 +30,28 @@
tags:
- upgrade
- include_tasks: set_cluster_health.yml
when: is_etcd_master and etcd_cluster_setup
- include_tasks: configure.yml
when: is_etcd_master and etcd_cluster_setup
when: is_etcd_master
- include_tasks: refresh_config.yml
when: is_etcd_master and etcd_cluster_setup
when: is_etcd_master
- name: Restart etcd if certs changed
command: /bin/true
notify: restart etcd
when: is_etcd_master and etcd_secret_changed|default(false)
- name: Restart etcd-events if certs changed
command: /bin/true
notify: restart etcd
when: is_etcd_master and etcd_events_cluster_setup and etcd_secret_changed|default(false)
# reload-systemd
- meta: flush_handlers
- name: Ensure etcd is running
service:
name: etcd
state: started
state: restarted
enabled: yes
when: is_etcd_master and etcd_cluster_setup
when: is_etcd_master and etcd_cluster_setup and etcd_secret_changed|default(false)
- name: Ensure etcd-events is running
- name: Restart etcd-events if certs changed
service:
name: etcd-events
state: started
state: restarted
enabled: yes
when: is_etcd_master and etcd_events_cluster_setup
when: is_etcd_master and etcd_events_cluster_setup and etcd_secret_changed|default(false)
# After etcd cluster is assembled, make sure that
# initial state of the cluster is in `existing`
# state insted of `new`.
- include_tasks: set_cluster_health.yml
when: is_etcd_master and etcd_cluster_setup
- include_tasks: refresh_config.yml
when: is_etcd_master and etcd_cluster_setup
when: is_etcd_master