* ignore idea * Initial work on support for k0s * * Changed config param to bootstrap_distribution * Replaced democratic-csi with openebs * Added notes about system-upgrade-controller being ignored with k0s * Removed password for nodes * * Switched to single storage path for openebs * Removed democratic-csi helm repo * Added missing openebs helm repo * Fixed template formatting * Made bootstrap_private_github_repo hidden/undocumented * Updated flux cluster config to accommodate bootstrap_private_github_repo * * added the storageclass name to be declarative * * added newline * set chart wait false * * fixed spacing in K0sTasks * fixed openebs path * properly added openebs helm repo * * updated configure task to use venv * renamed bootstrap_kube_vip_addr to bootstrap_kubeapi_addr * renamed bootstrap_kube_vip_addr derived variables accordingly * * tweaked configure task cmd * started work on k0s-config.yaml template * * tweaked k0s task cmd * moved coredns under addons rather than optional * fixed typo in coredns task * normalized formatting in k0s-config * disabled telemetry in k0s-config * added renovate to k0s-config * removed tunnel and added routing mode in k0s-config cilium chart values * updated docs in config example * fixed issue with k0s-config controller role so it didn't default to worker+controller if more than one master * * fixed whitespace * add k0sctl to brew tasks * Update bootstrap/vars/config.sample.yaml * Update bootstrap/vars/config.sample.yaml * Update k0s-config.yaml.j2 * Update config.sample.yaml * controllerManager and scheduler bind to `0.0.0.0` for metrics * Update custom-cilium-helmchart.yaml.j2.j2 * Update helmvalues.yaml.j2 * Update bootstrap/tasks/addons/main.yaml * first pass at readme updates * update placement of k0sconfig options * disable telemetry on k0sctl too * disable k0s telemetry in env too * update: jinja spacing in k0sconfig Signed-off-by: Devin Buhl <devin@buhl.casa> * fix: ensure bootstrap_local_storage_path is delete on nuke Signed-off-by: Devin Buhl <devin@buhl.casa> * fix: update renovate regex for k3s/k0s Signed-off-by: Devin Buhl <devin@buhl.casa> * fix: update nuke playbook and only include k3s task when k3s Signed-off-by: Devin Buhl <devin@buhl.casa> * fix: update nuke playbook and only include k3s task when k3s and include jinja comments Signed-off-by: Devin Buhl <devin@buhl.casa> --------- Signed-off-by: Devin Buhl <devin@buhl.casa> Co-authored-by: Devin Buhl <onedr0p@users.noreply.github.com> Co-authored-by: Devin Buhl <devin@buhl.casa>
107 lines
3.3 KiB
YAML
107 lines
3.3 KiB
YAML
#jinja2: trim_blocks: True, lstrip_blocks: True
|
|
---
|
|
- name: Cluster Nuke
|
|
hosts: kubernetes
|
|
become: true
|
|
gather_facts: true
|
|
any_errors_fatal: true
|
|
vars_prompt:
|
|
- name: nuke
|
|
prompt: |-
|
|
Are you sure you want to nuke this cluster?
|
|
Type 'YES I WANT TO DESTROY THIS CLUSTER' to proceed
|
|
default: "n"
|
|
private: false
|
|
pre_tasks:
|
|
- name: Check for confirmation
|
|
ansible.builtin.fail:
|
|
msg: Aborted nuking the cluster
|
|
when: nuke != 'YES I WANT TO DESTROY THIS CLUSTER'
|
|
|
|
- name: Pausing for 5 seconds...
|
|
ansible.builtin.pause:
|
|
seconds: 5
|
|
tasks:
|
|
{% if bootstrap_distribution == "k3s" %}
|
|
- name: Stop Kubernetes # noqa: ignore-errors
|
|
ignore_errors: true
|
|
block:
|
|
- name: Stop Kubernetes
|
|
ansible.builtin.include_role:
|
|
name: xanmanning.k3s
|
|
public: true
|
|
vars:
|
|
k3s_state: stopped
|
|
{% endif %}
|
|
|
|
# https://github.com/k3s-io/docs/blob/main/docs/installation/network-options.md
|
|
- name: Networking
|
|
block:
|
|
- name: Networking | Delete Cilium links
|
|
ansible.builtin.command:
|
|
cmd: "ip link delete {% raw %}{{ item }}{% endraw %}"
|
|
removes: "/sys/class/net/{% raw %}{{ item }}{% endraw %}"
|
|
loop: ["cilium_host", "cilium_net", "cilium_vxlan"]
|
|
- name: Networking | Flush iptables
|
|
ansible.builtin.iptables:
|
|
table: "{% raw %}{{ item }}{% endraw %}"
|
|
flush: true
|
|
loop: ["filter", "nat", "mangle", "raw"]
|
|
- name: Networking | Flush ip6tables
|
|
ansible.builtin.iptables:
|
|
table: "{% raw %}{{ item }}{% endraw %}"
|
|
flush: true
|
|
ip_version: ipv6
|
|
loop: ["filter", "nat", "mangle", "raw"]
|
|
- name: Networking | Delete CNI directory
|
|
ansible.builtin.file:
|
|
path: /etc/cni/net.d
|
|
state: absent
|
|
|
|
{% if bootstrap_distribution == "k3s" %}
|
|
- name: Check to see if k3s-killall.sh exits
|
|
ansible.builtin.stat:
|
|
path: /usr/local/bin/k3s-killall.sh
|
|
register: check_k3s_killall_script
|
|
|
|
- name: Check to see if k3s-uninstall.sh exits
|
|
ansible.builtin.stat:
|
|
path: /usr/local/bin/k3s-uninstall.sh
|
|
register: check_k3s_uninstall_script
|
|
|
|
- name: Run k3s-killall.sh
|
|
when: check_k3s_killall_script.stat.exists
|
|
ansible.builtin.command:
|
|
cmd: /usr/local/bin/k3s-killall.sh
|
|
register: k3s_killall
|
|
changed_when: k3s_killall.rc == 0
|
|
|
|
- name: Run k3s-uninstall.sh
|
|
when: check_k3s_uninstall_script.stat.exists
|
|
ansible.builtin.command:
|
|
cmd: /usr/local/bin/k3s-uninstall.sh
|
|
args:
|
|
removes: /usr/local/bin/k3s-uninstall.sh
|
|
register: k3s_uninstall
|
|
changed_when: k3s_uninstall.rc == 0
|
|
|
|
- name: Ensure hard links are removed
|
|
when:
|
|
- k3s_install_hard_links
|
|
- not ansible_check_mode
|
|
ansible.builtin.file:
|
|
path: "{% raw %}{{ k3s_install_dir }}/{{ item }}{% endraw %}"
|
|
state: absent
|
|
loop: ["kubectl", "crictl", "ctr"]
|
|
{% endif %}
|
|
|
|
- name: Remove local storage path
|
|
ansible.builtin.file:
|
|
path: "{% raw %}{{ bootstrap_local_storage_path }}{% endraw %}"
|
|
state: absent
|
|
|
|
- name: Reboot
|
|
ansible.builtin.reboot:
|
|
msg: Rebooting nodes
|
|
reboot_timeout: 3600
|