From 9d0299daf81cd448447bbeb3e033b3b3068bb66c Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Wed, 9 May 2018 14:51:36 -0500 Subject: [PATCH] Fix idempotence for web ui enablement. --- README.md | 2 +- tasks/main.yml | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 73bb439..5b40de6 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ TODO. TODO. - kubernetes_enable_web_ui: True + kubernetes_enable_web_ui: False TODO. diff --git a/tasks/main.yml b/tasks/main.yml index 6561c16..62f4d4b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -75,6 +75,14 @@ - kubernetes_allow_pods_on_master - kubernetes_init_stat.stat.exists == False +- name: Check if Kubernetes Dashboard UI service already exists. + shell: kubectl get services --namespace kube-system | grep -q kubernetes-dashboard + changed_when: False + register: kubernetes_dashboard_service + when: kubernetes_enable_web_ui + - name: Enable the Kubernetes Web Dashboard UI (if configured). command: "kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml" - when: kubernetes_enable_web_ui + when: + - kubernetes_enable_web_ui + - kubernetes_dashboard_service is failed