From 93897ea7d5d8e11725aa1c285fac64388215d00b Mon Sep 17 00:00:00 2001 From: Jon Date: Sun, 29 Oct 2023 15:58:00 +0930 Subject: [PATCH] refactor: moved config file deploy to be part of install tasks they are required to install k2s !2 --- tasks/k3s/configure.yaml | 5 +++-- tasks/k3s/install.yaml | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/tasks/k3s/configure.yaml b/tasks/k3s/configure.yaml index 563bf89..abe54a8 100644 --- a/tasks/k3s/configure.yaml +++ b/tasks/k3s/configure.yaml @@ -57,17 +57,18 @@ templates_to_apply: - src: "calico.yaml.j2" dest: /var/lib/rancher/k3s/server/manifests/calico.yaml + - src: kubernetes-manifest-rbac.yaml.j2 dest: /var/lib/rancher/k3s/server/manifests/rbac-authorization-common.yaml - # - src: firewall-kubernetes.j2 - # dest: "/etc/network/if-up.d/firewall-kubernetes" - src: iptables-kubernetes.rules.j2 dest: "/etc/iptables.rules.d/iptables-kubernetes.rules" notify: firewall_reloader + - src: k3s-registries.yaml.j2 dest: /etc/rancher/k3s/registries.yaml notify: kubernetes_restart + - src: k3s-config.yaml.j2 dest: /etc/rancher/k3s/config.yaml notify: kubernetes_restart diff --git a/tasks/k3s/install.yaml b/tasks/k3s/install.yaml index b03562c..a4038f8 100644 --- a/tasks/k3s/install.yaml +++ b/tasks/k3s/install.yaml @@ -117,6 +117,21 @@ loop: "{{ k3s.files }}" +- name: Copy Intial required templates + ansible.builtin.template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: root + mode: '700' + force: true + notify: "{{ item.notify | default(omit) }}" + loop: "{{ templates_to_apply }}" + vars: + templates_to_apply: + - src: k3s-config.yaml.j2 + dest: /etc/rancher/k3s/config.yaml + notify: kubernetes_restart + # - name: Templates IPv6 # ansible.builtin.template: # src: iptables-kubernetes.rules.j2