4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
25 master_list: "{{ groups.caas_master | list }}"
27 - include_tasks: wait_for_etcd.yml
30 when: ( groups['caas_master']|length|int > 1 ) and ( not nodename | search('caas_master1'))
32 - name: template etcd manifest
35 dest: /etc/kubernetes/manifests/etcd.yml
38 - name: wait for container to start
40 host: "{{ ansible_host }}"
41 port: "{{ caas.etcd_api_port }}"
43 timeout: "{{ caas.container_wait_timeout }}"
46 - include_tasks: add_member.yml
48 - "{{ hostvars[groups.caas_master[1]]['networking']['infra_internal']['ip'] }}"
49 - "{{ hostvars[groups.caas_master[2]]['networking']['infra_internal']['ip'] }}"
50 when: ( nodename | search("caas_master1") ) and ( groups['caas_master']|length|int > 1 )
52 - name: etcd docker id
53 shell: "docker ps | grep etcd | grep -v pause | awk -F' ' '{ print $1 }'"
55 DOCKER_HOST: "tcp://{{ networking.infra_internal.ip }}:2375"
56 DOCKER_TLS_VERIFY: "1"
57 DOCKER_CERT_PATH: "/etc/docker"
58 register: etcd_container_id
59 until: etcd_container_id.stdout
64 shell: "docker exec -t {{ etcd_container_id.stdout }} etcdctl3 member list | grep started | wc -l"
66 DOCKER_HOST: "tcp://{{ networking.infra_internal.ip }}:2375"
67 DOCKER_TLS_VERIFY: "1"
68 DOCKER_CERT_PATH: "/etc/docker"
70 until: result.stdout|int == master_list|length|int