fix: ansible dir should only exist for k3s and k0s (#1191)

* fix: ansible dir should only exist for k3s and k0s

Signed-off-by: Devin Buhl <devin@buhl.casa>

* fix: rename partial files

Signed-off-by: Devin Buhl <devin@buhl.casa>

---------

Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
Devin Buhl authored and GitHub committed 2024-01-18 13:52:11 -05:00
1 parent bae0be1ef0
commit 0c4f0260d5
13 files changed
+18 -8

No files matched your search

@@ -1,3 +1,4 @@
#% if bootstrap_distribution == 'k3s' or bootstrap_distribution == 'k0s' %#
skip_list: skip_list:
- yaml[commas] - yaml[commas]
- yaml[line-length] - yaml[line-length]
@@ -7,3 +8,4 @@ warn_list:
- deprecated-command-syntax - deprecated-command-syntax
- experimental - experimental
- no-changed-when - no-changed-when
#% endif %#
@@ -1,3 +1,4 @@
#% if bootstrap_distribution == 'k3s' or bootstrap_distribution == 'k0s' %#
--- ---
timezone: "#{ bootstrap_timezone }#" timezone: "#{ bootstrap_timezone }#"
github_username: "#{ bootstrap_github_username }#" github_username: "#{ bootstrap_github_username }#"
@@ -17,3 +18,4 @@ node_cidr: "#{ bootstrap_node_cidr }#"
cluster_cidr_v6: "#{ bootstrap_cluster_cidr.split(',')[1] }#" cluster_cidr_v6: "#{ bootstrap_cluster_cidr.split(',')[1] }#"
service_cidr_v6: "#{ bootstrap_service_cidr.split(',')[1] }#" service_cidr_v6: "#{ bootstrap_service_cidr.split(',')[1] }#"
#% endif %# #% endif %#
#% endif %#
@@ -1,3 +1,4 @@
#% if bootstrap_distribution == 'k3s' or bootstrap_distribution == 'k0s' %#
--- ---
kubernetes: kubernetes:
children: children:
@@ -25,3 +26,4 @@ kubernetes:
#% endif %# #% endif %#
#% endfor %# #% endfor %#
#% endif %# #% endif %#
#% endif %#
@@ -1,3 +1,4 @@
#% if bootstrap_distribution == 'k3s' %#
--- ---
- name: Cluster Nuke - name: Cluster Nuke
hosts: kubernetes hosts: kubernetes
@@ -21,7 +22,6 @@
ansible.builtin.pause: ansible.builtin.pause:
seconds: 5 seconds: 5
tasks: tasks:
#% if bootstrap_distribution == "k3s" %#
- name: Stop Kubernetes # noqa: ignore-errors - name: Stop Kubernetes # noqa: ignore-errors
ignore_errors: true ignore_errors: true
block: block:
@@ -31,7 +31,6 @@
public: true public: true
vars: vars:
k3s_state: stopped k3s_state: stopped
#% endif %#
# https://github.com/k3s-io/docs/blob/main/docs/installation/network-options.md # https://github.com/k3s-io/docs/blob/main/docs/installation/network-options.md
- name: Networking - name: Networking
@@ -57,7 +56,6 @@
path: /etc/cni/net.d path: /etc/cni/net.d
state: absent state: absent
#% if bootstrap_distribution == "k3s" %#
- name: Check to see if k3s-killall.sh exits - name: Check to see if k3s-killall.sh exits
ansible.builtin.stat: ansible.builtin.stat:
path: /usr/local/bin/k3s-killall.sh path: /usr/local/bin/k3s-killall.sh
@@ -92,7 +90,6 @@
path: "{{ k3s_install_dir }}/{{ item }}" path: "{{ k3s_install_dir }}/{{ item }}"
state: absent state: absent
loop: ["kubectl", "crictl", "ctr"] loop: ["kubectl", "crictl", "ctr"]
#% endif %#
- name: Remove local storage path - name: Remove local storage path
ansible.builtin.file: ansible.builtin.file:
@@ -103,3 +100,4 @@
ansible.builtin.reboot: ansible.builtin.reboot:
msg: Rebooting nodes msg: Rebooting nodes
reboot_timeout: 3600 reboot_timeout: 3600
#% endif %#
@@ -1,3 +1,4 @@
#% if bootstrap_distribution == 'k3s' or bootstrap_distribution == 'k0s' %#
--- ---
- name: Prepare System - name: Prepare System
hosts: kubernetes hosts: kubernetes
@@ -130,3 +131,4 @@
ansible.builtin.reboot: ansible.builtin.reboot:
msg: Rebooting nodes msg: Rebooting nodes
reboot_timeout: 3600 reboot_timeout: 3600
#% endif %#
@@ -1,3 +1,4 @@
#% if bootstrap_distribution == 'k3s' or bootstrap_distribution == 'k0s' %#
--- ---
- name: Reboot - name: Reboot
hosts: kubernetes hosts: kubernetes
@@ -13,3 +14,4 @@
ansible.builtin.reboot: ansible.builtin.reboot:
msg: Rebooting nodes msg: Rebooting nodes
reboot_timeout: 3600 reboot_timeout: 3600
#% endif %#
@@ -1,3 +1,4 @@
#% if bootstrap_distribution == 'k3s' or bootstrap_distribution == 'k0s' %#
--- ---
# https://github.com/kevincoakley/ansible-role-k8s-rolling-update # https://github.com/kevincoakley/ansible-role-k8s-rolling-update
- name: Cluster rollout update - name: Cluster rollout update
@@ -86,3 +87,4 @@
#% endif %# #% endif %#
state: uncordon state: uncordon
delegate_to: "{{ groups['master'][0] }}" delegate_to: "{{ groups['master'][0] }}"
#% endif %#
@@ -15,6 +15,6 @@ spec:
bootstrap: true bootstrap: true
valuesContent: |- valuesContent: |-
#% filter indent(width=4, first=True) %# #% filter indent(width=4, first=True) %#
#% include 'partials/cilium-values-init.yaml.partial' %# #% include 'partials/cilium-values-init.partial.yaml.j2' %#
#% endfilter %# #% endfilter %#
#% endif %# #% endif %#
@@ -25,5 +25,5 @@ spec:
keepHistory: false keepHistory: false
values: values:
#% filter indent(width=4, first=True) %# #% filter indent(width=4, first=True) %#
#% include 'partials/cilium-values-full.yaml.partial' %# #% include 'partials/cilium-values-full.partial.yaml.j2' %#
#% endfilter %# #% endfilter %#
@@ -121,6 +121,6 @@ spec:
namespace: kube-system namespace: kube-system
values: |2 values: |2
#% filter indent(width=18, first=True) %# #% filter indent(width=18, first=True) %#
#% include 'partials/cilium-values-init.yaml.partial' %# #% include 'partials/cilium-values-init.partial.yaml.j2' %#
#% endfilter %# #% endfilter %#
#% endif %# #% endif %#
+1 -1
View File
@@ -1,7 +1,7 @@
[makejinja] [makejinja]
inputs = ["./bootstrap/templates"] inputs = ["./bootstrap/templates"]
output = "./" output = "./"
exclude_patterns = ["*.partial"] exclude_patterns = ["*.partial.yaml.j2"]
data = ["./bootstrap/vars/addons.yaml", "./bootstrap/vars/config.yaml"] data = ["./bootstrap/vars/addons.yaml", "./bootstrap/vars/config.yaml"]
import_paths = ["./bootstrap/scripts"] import_paths = ["./bootstrap/scripts"]
loaders = ["loader:Loader"] loaders = ["loader:Loader"]