feat: refactor config file (#1267)

Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
Devin Buhl authored and GitHub committed 2024-01-28 12:41:31 -05:00
1 parent e4427a8325
commit 889ca07692
114 files changed
+721 -1042

No files matched your search

@@ -1,4 +1,4 @@
#% if bootstrap_distribution in ['k3s'] %#
#% if distribution in ['k3s'] %#
---
- name: Cluster Installation
hosts: kubernetes
@@ -10,7 +10,7 @@
ansible.builtin.pause:
seconds: 5
tasks:
#% if bootstrap_distribution in ['k3s'] %#
#% if distribution in ['k3s'] %#
- name: Ensure Kubernetes is running
ansible.builtin.include_role:
name: xanmanning.k3s
@@ -21,9 +21,9 @@
- name: Upgrade kube-vip
ansible.builtin.template:
src: templates/kube-vip-ds.yaml.j2
#% if bootstrap_distribution in ['k3s'] %#
#% if distribution in ['k3s'] %#
dest: "{{ k3s_server_manifests_dir }}/kube-vip-ds.yaml"
#% elif bootstrap_distribution in ['k0s'] %#
#% elif distribution in ['k0s'] %#
dest: "/var/lib/k0s/manifests/kube-vip/kube-vip-ds.yaml"
#% endif %#
mode: preserve
@@ -1,4 +1,4 @@
#% if bootstrap_distribution in ['k3s'] %#
#% if distribution in ['k3s'] %#
---
- name: Cluster Nuke
hosts: kubernetes
@@ -98,6 +98,6 @@
- name: Reboot
ansible.builtin.reboot:
msg: Rebooting nodes
msg: Rebooting hosts
reboot_timeout: 3600
#% endif %#
@@ -1,4 +1,4 @@
#% if bootstrap_distribution in ['k3s'] %#
#% if distribution in ['k3s'] %#
---
- name: Prepare System
hosts: kubernetes
@@ -16,7 +16,7 @@
block:
- name: Locale | Set timezone
community.general.timezone:
name: "#{ bootstrap_timezone }#"
name: "#{ timezone }#"
- name: Packages
block:
@@ -46,7 +46,6 @@
ff02::2 ip6-allrouters
dest: /etc/hosts
mode: preserve
#% if bootstrap_advanced_flags.update_resolv_conf|default(true) %#
# https://github.com/onedr0p/flux-cluster-template/discussions/635
- name: Network Configuration | Remove immutable flag from /etc/resolv.conf
ansible.builtin.file:
@@ -63,9 +62,10 @@
mode: '0644'
dest: /etc/resolv.conf
content: |
search .
nameserver #{ bootstrap_dns_server }#
#% endif %#
search #{ cluster.nodes.search_domain|default('.', true) }#
#% for item in cluster.nodes.dns_servers %#
nameserver #{ item }#
#% endfor %#
- name: System Configuration
notify: Reboot
@@ -110,6 +110,6 @@
handlers:
- name: Reboot
ansible.builtin.reboot:
msg: Rebooting nodes
msg: Rebooting hosts
reboot_timeout: 3600
#% endif %#
@@ -11,5 +11,5 @@
tasks:
- name: Reboot
ansible.builtin.reboot:
msg: Rebooting nodes
msg: Rebooting hosts
reboot_timeout: 3600
@@ -12,9 +12,9 @@
seconds: 5
tasks:
- name: Details
#% if bootstrap_distribution in ['k3s'] %#
#% if distribution in ['k3s'] %#
ansible.builtin.command: "k3s kubectl get node {{ inventory_hostname }} -o json"
#% elif bootstrap_distribution in ['k0s'] %#
#% elif distribution in ['k0s'] %#
ansible.builtin.command: "k0s kubectl get node {{ inventory_hostname }} -o json"
#% endif %#
register: kubectl_get_node
@@ -32,9 +32,9 @@
- name: Cordon
kubernetes.core.k8s_drain:
name: "{{ inventory_hostname }}"
#% if bootstrap_distribution in ['k3s'] %#
#% if distribution in ['k3s'] %#
kubeconfig: /etc/rancher/k3s/k3s.yaml
#% elif bootstrap_distribution in ['k0s'] %#
#% elif distribution in ['k0s'] %#
kubeconfig: /var/lib/k0s/pki/admin.conf
#% endif %#
state: cordon
@@ -43,9 +43,9 @@
- name: Drain
kubernetes.core.k8s_drain:
name: "{{ inventory_hostname }}"
#% if bootstrap_distribution in ['k3s'] %#
#% if distribution in ['k3s'] %#
kubeconfig: /etc/rancher/k3s/k3s.yaml
#% elif bootstrap_distribution in ['k0s'] %#
#% elif distribution in ['k0s'] %#
kubeconfig: /var/lib/k0s/pki/admin.conf
#% endif %#
state: drain
@@ -78,9 +78,9 @@
- name: Uncordon
kubernetes.core.k8s_drain:
name: "{{ inventory_hostname }}"
#% if bootstrap_distribution in ['k3s'] %#
#% if distribution in ['k3s'] %#
kubeconfig: /etc/rancher/k3s/k3s.yaml
#% elif bootstrap_distribution in ['k0s'] %#
#% elif distribution in ['k0s'] %#
kubeconfig: /var/lib/k0s/pki/admin.conf
#% endif %#
state: uncordon
@@ -1 +1 @@
main = lambda data: data.get("bootstrap_distribution") in ['k3s']
main = lambda data: data.get("distribution") in ['k3s']
@@ -1 +1 @@
main = lambda data: data.get("bootstrap_distribution") in ['k3s']
main = lambda data: data.get("distribution") in ['k3s']