From bee65e693b56a89e709d2125e08bcddb13310c9f Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 4 Dec 2015 09:32:40 -0400 Subject: Bring first etcd server up before others. In faster environments (i.e. all local VMs) etcd nodes could come online at roughly the same time leading to conflicts with self-elections, resulting in a non-functional cluster. To solve we configure the first etcd host by itself, then configure the remaining ones in parallel to keep things as fast as possible. --- playbooks/common/openshift-etcd/config.yml | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/playbooks/common/openshift-etcd/config.yml b/playbooks/common/openshift-etcd/config.yml index 7d94ced2e..3d7a884e8 100644 --- a/playbooks/common/openshift-etcd/config.yml +++ b/playbooks/common/openshift-etcd/config.yml @@ -68,8 +68,32 @@ validate_checksum: yes with_items: etcd_needing_server_certs -- name: Configure etcd hosts - hosts: oo_etcd_to_config +# Configure a first etcd host to avoid conflicts in choosing a leader +# if other members come online too quickly. +- name: Configure first etcd host + hosts: oo_first_etcd + vars: + sync_tmpdir: "{{ hostvars.localhost.g_etcd_mktemp.stdout }}" + etcd_url_scheme: https + etcd_peer_url_scheme: https + etcd_peers_group: oo_etcd_to_config + pre_tasks: + - name: Ensure certificate directory exists + file: + path: "{{ etcd_cert_config_dir }}" + state: directory + - name: Unarchive the tarball on the etcd host + unarchive: + src: "{{ sync_tmpdir }}/{{ etcd_cert_subdir }}.tgz" + dest: "{{ etcd_cert_config_dir }}" + when: etcd_server_certs_missing + roles: + - etcd + - role: nickhammond.logrotate + +# Configure the remaining etcd hosts, skipping the first one we dealt with above. +- name: Configure remaining etcd hosts + hosts: oo_etcd_to_config:!oo_first_etcd vars: sync_tmpdir: "{{ hostvars.localhost.g_etcd_mktemp.stdout }}" etcd_url_scheme: https -- cgit v1.2.3