openstack-helm-infra/roles/deploy-kubeadm-aio-node/tasks/util-generate-join-command.yaml
Andrii Ostapenko 8f24a74bc7 Introduces templates linting
This commit rewrites lint job to make template linting available.
Currently yamllint is run in warning mode against all templates
rendered with default values. Duplicates detected and issues will be
addressed in subsequent commits.

Also all y*ml files are added for linting and corresponding code changes
are made. For non-templates warning rules are disabled to improve
readability. Chart and requirements yamls are also modified in the name
of consistency.

Change-Id: Ife6727c5721a00c65902340d95b7edb0a9c77365
2020-06-11 23:29:42 -05:00

57 lines
2.0 KiB
YAML

# 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
...