9dd81954fd
This proposes moving the playbooks and roles to the top level of osh-infra to be consumed by osh Change-Id: I7e3516da8e516060f94b8b9c8875918504de7446
57 lines
2.1 KiB
YAML
57 lines
2.1 KiB
YAML
# Copyright 2017 The Openstack-Helm Authors.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
- name: generate the kubeadm join command for nodes
|
|
vars:
|
|
kubeadm_aio_action: generate-join-cmd
|
|
kubeadm_cluster_join_ttl: 30m
|
|
kube_worker: null
|
|
block:
|
|
- name: "deploying kubeadm {{ kubeadm_aio_action }} container"
|
|
become: true
|
|
become_user: root
|
|
docker_container:
|
|
name: "kubeadm-{{ kube_worker }}-{{ kubeadm_aio_action }}"
|
|
image: "{{ images.kubernetes.kubeadm_aio }}"
|
|
state: started
|
|
detach: false
|
|
recreate: yes
|
|
network_mode: host
|
|
volumes:
|
|
- /etc/kubernetes:/etc/kubernetes:ro
|
|
env:
|
|
ACTION=generate-join-cmd
|
|
TTL="{{ kubeadm_cluster_join_ttl }}"
|
|
register: kubeadm_generate_join_command
|
|
- name: "getting logs for {{ kubeadm_aio_action }} action"
|
|
command: "docker logs kubeadm-{{ kube_worker }}-{{ kubeadm_aio_action }}"
|
|
become: true
|
|
become_user: root
|
|
register: kubeadm_aio_action_logs
|
|
- name: storing cluster join command
|
|
set_fact: kubeadm_cluster_join_command="{{ kubeadm_aio_action_logs.stdout }}"
|
|
rescue:
|
|
- name: "dumping logs for {{ kubeadm_aio_action }} action"
|
|
debug:
|
|
var: kubeadm_aio_action_logs.stdout_lines
|
|
- name: "exiting if {{ kubeadm_aio_action }} action failed"
|
|
command: exit 1
|
|
always:
|
|
- name: "removing container for {{ kubeadm_aio_action }} action"
|
|
become: true
|
|
become_user: root
|
|
docker_container:
|
|
name: "kubeadm-{{ kube_worker }}-{{ kubeadm_aio_action }}"
|
|
state: absent
|