diff --git a/README.md b/README.md index eca7109..184864b 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,9 @@ Extra args to pass to `kubeadm init` during K8s control plane initialization. E. Whether to remove the taint that denies pods from being deployed to the Kubernetes master. If you have a single-node cluster, this should definitely be `True`. Otherwise, set to `False` if you want a dedicated Kubernetes master which doesn't run any other pods. kubernetes_enable_web_ui: false + kubernetes_web_ui_manifest_file: https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml -Whether to enable the Kubernetes web dashboard UI (only accessible on the master itself, or proxied). +Whether to enable the Kubernetes web dashboard UI (only accessible on the master itself, or proxied), and the file containing the web dashboard UI manifest. kubernetes_pod_network_cidr: '10.244.0.0/16' kubernetes_apiserver_advertise_address: '' diff --git a/defaults/main.yml b/defaults/main.yml index dc937ce..3d9ef31 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -19,6 +19,7 @@ kubernetes_kubeadm_init_extra_opts: "" kubernetes_allow_pods_on_master: true kubernetes_enable_web_ui: true +kubernetes_web_ui_manifest_file: https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml kubernetes_pod_network_cidr: '10.244.0.0/16' kubernetes_apiserver_advertise_address: '' diff --git a/tasks/kubelet-setup.yml b/tasks/kubelet-setup.yml index 13f161f..939046e 100644 --- a/tasks/kubelet-setup.yml +++ b/tasks/kubelet-setup.yml @@ -16,7 +16,7 @@ kubelet_args_path: '/etc/systemd/system/kubelet.service.d/10-kubeadm.conf' kubelet_args_line: "{{ 'Environment=\"KUBELET_EXTRA_ARGS=' + kubernetes_kubelet_extra_args + '\"' }}" kubelet_args_regexp: '^Environment=' - when: kubelet_environment_file.stat.exists == false + when: not kubelet_environment_file.stat.exists - name: Configure KUBELET_EXTRA_ARGS. lineinfile: diff --git a/tasks/master-setup.yml b/tasks/master-setup.yml index ee31867..7db6767 100644 --- a/tasks/master-setup.yml +++ b/tasks/master-setup.yml @@ -10,13 +10,13 @@ register: kubeadmin_init failed_when: false - when: kubernetes_init_stat.stat.exists == false + when: not kubernetes_init_stat.stat.exists - name: Print the init output to screen. debug: var: kubeadmin_init.stdout verbosity: 2 - when: kubernetes_init_stat.stat.exists == false + when: not kubernetes_init_stat.stat.exists - name: Ensure .kube directory exists. file: @@ -43,7 +43,7 @@ command: "kubectl taint nodes --all node-role.kubernetes.io/master-" when: - kubernetes_allow_pods_on_master - - kubernetes_init_stat.stat.exists == false + - not kubernetes_init_stat.stat.exists - name: Check if Kubernetes Dashboard UI service already exists. shell: kubectl get services --namespace kube-system | grep -q kubernetes-dashboard @@ -53,7 +53,7 @@ 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" + command: "kubectl create -f {{ kubernetes_web_ui_manifest_file }}" when: - kubernetes_enable_web_ui - kubernetes_dashboard_service is failed diff --git a/tasks/node-setup.yml b/tasks/node-setup.yml index 442c353..304cbf1 100644 --- a/tasks/node-setup.yml +++ b/tasks/node-setup.yml @@ -3,3 +3,4 @@ shell: > {{ kubernetes_join_command }} creates=/etc/kubernetes/kubelet.conf + tags: ['skip_ansible_lint']