Files
home-cluster/bootstrap/templates/ansible/playbooks/tasks/cruft.yaml.j2
T

33 lines
1.1 KiB
YAML

---
# https://github.com/k3s-io/k3s/issues/1971
- name: Cruft
block:
- name: Cruft | Get list of custom mantifests
ansible.builtin.find:
paths: "{% raw %}{{ k3s_server_manifests_dir }}{% endraw %}"
file_type: file
use_regex: true
patterns: ["^custom-.*"]
register: custom_manifest
- name: Cruft | Delete custom mantifests
ansible.builtin.file:
path: "{% raw %}{{ item.path }}{% endraw %}"
state: absent
loop: "{% raw %}{{ custom_manifest.files }}{% endraw %}"
- name: Cruft | Get list of custom addons
kubernetes.core.k8s_info:
kubeconfig: /etc/rancher/k3s/k3s.yaml
kind: Addon
register: addons_list
- name: Cruft | Delete addons
kubernetes.core.k8s:
kubeconfig: /etc/rancher/k3s/k3s.yaml
name: "{% raw %}{{ item.metadata.name }}{% endraw %}"
kind: Addon
namespace: kube-system
state: absent
loop: "{% raw %}{{ addons_list.resources | selectattr('metadata.name', 'match', '^custom-.*') | list }}{% endraw %}"