From e6eb8f3b9fb6dc0c39572c66afcc9ccccfe31c6d Mon Sep 17 00:00:00 2001 From: Dean Taylor Date: Tue, 9 Feb 2021 22:31:42 +0800 Subject: [PATCH] fix missing dir. --- contrib/ansible/roles/k8s-dev/tasks/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/ansible/roles/k8s-dev/tasks/main.yml b/contrib/ansible/roles/k8s-dev/tasks/main.yml index da4d39f..096b530 100644 --- a/contrib/ansible/roles/k8s-dev/tasks/main.yml +++ b/contrib/ansible/roles/k8s-dev/tasks/main.yml @@ -56,7 +56,9 @@ fi dest: /etc/profile.d/KUBECONFIG.sh - name: kubectl config for ansible user - shell: 'microk8s config | sed "s/\(user\|name\): admin/\1: microk8s-admin/" > {{ ansible_user_dir }}/.kube/microk8s.config' + shell: > + [ -d {{ ansible_user_dir }}/.kube ] || mkdir -p {{ ansible_user_dir }}/.kube; \ + microk8s config | sed "s/\(user\|name\): admin/\1: microk8s-admin/" > {{ ansible_user_dir }}/.kube/microk8s.config args: creates: "{{ ansible_user_dir }}/.kube/microk8s.config" - name: Wait for microk8s to start