diff options
Diffstat (limited to 'roles/kubernetes/addons/ingress-nginx/tasks/main.yml')
-rw-r--r-- | roles/kubernetes/addons/ingress-nginx/tasks/main.yml | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/roles/kubernetes/addons/ingress-nginx/tasks/main.yml b/roles/kubernetes/addons/ingress-nginx/tasks/main.yml new file mode 100644 index 00000000..db918a4d --- /dev/null +++ b/roles/kubernetes/addons/ingress-nginx/tasks/main.yml @@ -0,0 +1,32 @@ +--- +- name: deploy ingress-nginx addon + run_once: true + delegate_to: "{{ groups['_kubernetes_primary_controlplane_node_'] | first }}" + block: + - name: create base directory for ingress-nginx addon + file: + path: /etc/kubernetes/addons/ingress-nginx + state: directory + + ## you may download these using the following command: + # wget -O deploy.{{ kubernetes_ingress_nginx_version }}.yml https://github.com/kubernetes/ingress-nginx/raw/controller-v{{ kubernetes_ingress_nginx_version }}/deploy/static/provider/baremetal/deploy.yaml + - name: copy base config for ingress-nginx + copy: + src: "deploy.{{ kubernetes_ingress_nginx_version }}.yml" + dest: /etc/kubernetes/addons/ingress-nginx/upstream.yml + + - name: generate kustomization for ingress-nginx + template: + src: "kustomization.{{ kubernetes_ingress_nginx_variant }}.yml.j2" + dest: /etc/kubernetes/addons/ingress-nginx/kustomization.yml + + - name: check if ingress-nginx is already installed + check_mode: no + command: kubectl --kubeconfig /etc/kubernetes/admin.conf diff -k /etc/kubernetes/addons/ingress-nginx + failed_when: false + changed_when: false + register: kube_ingress_nginx_diff_result + + - name: install ingress-nginx onto the cluster + when: kube_ingress_nginx_diff_result.rc != 0 + command: kubectl --kubeconfig /etc/kubernetes/admin.conf apply -k /etc/kubernetes/addons/ingress-nginx |