var registered for rc.local check is rcfile but under when it said rclocal which was undefined. changed to rcfile to correct.
85 lines
2.0 KiB
YAML
85 lines
2.0 KiB
YAML
---
|
|
- name: Disable services
|
|
systemd:
|
|
name: "{{ item }}"
|
|
state: stopped
|
|
enabled: no
|
|
failed_when: false
|
|
with_items:
|
|
- k3s
|
|
- k3s-node
|
|
- k3s-init
|
|
|
|
- name: RUN pkill -9 -f "k3s/data/[^/]+/bin/containerd-shim-runc"
|
|
register: pkill_containerd_shim_runc
|
|
command: pkill -9 -f "k3s/data/[^/]+/bin/containerd-shim-runc"
|
|
changed_when: "pkill_containerd_shim_runc.rc == 0"
|
|
failed_when: false
|
|
|
|
- name: Umount k3s filesystems
|
|
include_tasks: umount_with_children.yml
|
|
with_items:
|
|
- /run/k3s
|
|
- /var/lib/kubelet
|
|
- /run/netns
|
|
- /var/lib/rancher/k3s
|
|
- /var/lib/kubelet/pods
|
|
- /var/lib/kubelet/plugins
|
|
- /run/netns/cni-
|
|
loop_control:
|
|
loop_var: mounted_fs
|
|
|
|
- name: Remove service files, binaries and data
|
|
file:
|
|
name: "{{ item }}"
|
|
state: absent
|
|
with_items:
|
|
- /usr/local/bin/k3s
|
|
- "{{ systemd_dir }}/k3s.service"
|
|
- "{{ systemd_dir }}/k3s-node.service"
|
|
- /etc/rancher/k3s
|
|
- /run/k3s
|
|
- /run/flannel
|
|
- /etc/rancher/
|
|
- /var/lib/kubelet
|
|
- /var/lib/rancher/k3s
|
|
- /var/lib/rancher/
|
|
- /var/lib/cni/
|
|
|
|
- name: Reload daemon_reload
|
|
systemd:
|
|
daemon_reload: yes
|
|
|
|
- name: Remove tmp directory used for manifests
|
|
file:
|
|
path: /tmp/k3s
|
|
state: absent
|
|
|
|
- name: Check if rc.local exists
|
|
stat:
|
|
path: /etc/rc.local
|
|
register: rcfile
|
|
|
|
- name: Remove rc.local modifications for proxmox lxc containers
|
|
become: true
|
|
blockinfile:
|
|
path: /etc/rc.local
|
|
content: "{{ lookup('template', 'templates/rc.local.j2') }}"
|
|
create: false
|
|
state: absent
|
|
when: proxmox_lxc_configure and rcfile.stat.exists
|
|
|
|
- name: Check rc.local for cleanup
|
|
become: true
|
|
slurp:
|
|
src: /etc/rc.local
|
|
register: rcslurp
|
|
when: proxmox_lxc_configure and rcfile.stat.exists
|
|
|
|
- name: Cleanup rc.local if we only have a Shebang line
|
|
become: true
|
|
file:
|
|
path: /etc/rc.local
|
|
state: absent
|
|
when: proxmox_lxc_configure and rcfile.stat.exists and ((rcslurp.content | b64decode).splitlines() | length) <= 1
|