KubeADM: Move shell commands to use bash and set env vars
This PS moves the shell module invocations to use bash and set the required env vars explicity. This can seolve some issues on ubuntu workstation hosts which uses dash for shell commands by default. Change-Id: Ieb440e421d9d95676719d66fb4c787f88a9d8a2b
This commit is contained in:
parent
172844c662
commit
864f554a72
@ -29,6 +29,8 @@
|
||||
- name: clean | kube | removing any old docker containers
|
||||
ignore_errors: yes
|
||||
shell: MY_CONTAINER_ID=$(docker inspect --format {% raw %}'{{ .Id }}'{% endraw %} "{{ my_container_name }}"); docker ps --all --no-trunc --quiet | awk '!'"/${MY_CONTAINER_ID}/ { print \$1 }" | xargs -r -l1 -P16 docker rm -f
|
||||
args:
|
||||
executable: /bin/bash
|
||||
|
||||
- name: clean | kube | remove any mounts
|
||||
ignore_errors: yes
|
||||
@ -36,6 +38,8 @@
|
||||
for MOUNT in $(findmnt --df --output TARGET | grep "^/var/lib/kubelet"); do
|
||||
umount --force $MOUNT
|
||||
done
|
||||
args:
|
||||
executable: /bin/bash
|
||||
|
||||
- name: clean | kube | remove dirs
|
||||
file:
|
||||
|
@ -84,17 +84,25 @@
|
||||
delegate_to: 127.0.0.1
|
||||
block:
|
||||
- name: wait for kube api
|
||||
shell: export KUBECONFIG=/mnt/rootfs/etc/kubernetes/admin.conf; python /usr/bin/test-kube-api.py
|
||||
shell: python /usr/bin/test-kube-api.py
|
||||
register: task_result
|
||||
until: task_result.rc == 0
|
||||
retries: 120
|
||||
delay: 5
|
||||
environment:
|
||||
KUBECONFIG: '/mnt/rootfs/etc/kubernetes/admin.conf'
|
||||
args:
|
||||
executable: /bin/bash
|
||||
- name: wait for node to come online
|
||||
shell: export KUBECONFIG=/mnt/rootfs/etc/kubernetes/admin.conf; kubectl get node "{{ kubeadm_node_hostname }}" --no-headers | gawk '{ print $2 }' | grep -q '\(^Ready\)\|\(^NotReady\)'
|
||||
shell: kubectl get node "{{ kubeadm_node_hostname }}" --no-headers | gawk '{ print $2 }' | grep -q '\(^Ready\)\|\(^NotReady\)'
|
||||
register: task_result
|
||||
until: task_result.rc == 0
|
||||
retries: 120
|
||||
delay: 5
|
||||
environment:
|
||||
KUBECONFIG: '/mnt/rootfs/etc/kubernetes/admin.conf'
|
||||
args:
|
||||
executable: /bin/bash
|
||||
- include_tasks: wait-for-kube-system-namespace.yaml
|
||||
|
||||
- name: deploying kube-proxy
|
||||
@ -107,11 +115,15 @@
|
||||
delegate_to: 127.0.0.1
|
||||
block:
|
||||
- name: wait for node to be ready
|
||||
shell: export KUBECONFIG=/mnt/rootfs/etc/kubernetes/admin.conf; kubectl get node "{{ kubeadm_node_hostname }}" --no-headers | gawk '{ print $2 }' | grep -q '^Ready'
|
||||
shell: kubectl get node "{{ kubeadm_node_hostname }}" --no-headers | gawk '{ print $2 }' | grep -q '^Ready'
|
||||
register: task_result
|
||||
until: task_result.rc == 0
|
||||
retries: 120
|
||||
delay: 5
|
||||
environment:
|
||||
KUBECONFIG: '/mnt/rootfs/etc/kubernetes/admin.conf'
|
||||
args:
|
||||
executable: /bin/bash
|
||||
- include_tasks: wait-for-kube-system-namespace.yaml
|
||||
|
||||
# - name: deploying kube-dns addon
|
||||
|
@ -14,8 +14,12 @@
|
||||
|
||||
- name: wait for kube pods to all be running in kube-system namespace
|
||||
delegate_to: 127.0.0.1
|
||||
shell: export KUBECONFIG=/mnt/rootfs/etc/kubernetes/admin.conf; /usr/bin/test-kube-pods-ready kube-system
|
||||
shell: /usr/bin/test-kube-pods-ready kube-system
|
||||
register: task_result
|
||||
until: task_result.rc == 0
|
||||
retries: 120
|
||||
delay: 5
|
||||
environment:
|
||||
KUBECONFIG: '/mnt/rootfs/etc/kubernetes/admin.conf'
|
||||
args:
|
||||
executable: /bin/bash
|
||||
|
@ -56,6 +56,8 @@
|
||||
- name: docker | getting cgroup driver info
|
||||
shell: docker info | awk '/^Cgroup Driver:/ { print $NF }'
|
||||
register: docker_cgroup_driver
|
||||
args:
|
||||
executable: /bin/bash
|
||||
- name: setting kublet cgroup driver
|
||||
set_fact:
|
||||
kubelet_cgroup_driver: "{{ docker_cgroup_driver.stdout }}"
|
||||
|
@ -47,3 +47,5 @@
|
||||
until: task_result.rc == 0
|
||||
retries: 120
|
||||
delay: 5
|
||||
args:
|
||||
executable: /bin/bash
|
||||
|
Loading…
x
Reference in New Issue
Block a user