mirror of
https://github.com/k3s-io/k3s-ansible.git
synced 2025-12-25 00:12:37 +01:00
Simplify reset playbook (#230)
* Simplify reset playbook Signed-off-by: Derek Nola <derek.nola@suse.com> * Cleanup ansible_user kubeconfig Signed-off-by: Derek Nola <derek.nola@suse.com> --------- Signed-off-by: Derek Nola <derek.nola@suse.com>
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
---
|
||||
- name: Clean previous failed runs of k3s-init
|
||||
# systemd builtin does not support reset-failed
|
||||
ansible.builtin.command: systemctl reset-failed k3s-init # noqa: command-instead-of-module
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
|
||||
- name: Disable services
|
||||
ansible.builtin.systemd:
|
||||
name: "{{ item }}"
|
||||
state: stopped
|
||||
enabled: false
|
||||
failed_when: false
|
||||
with_items:
|
||||
- k3s-init
|
||||
- k3s-server
|
||||
- k3s-agent
|
||||
|
||||
- name: Kill container shim
|
||||
ansible.builtin.command: pkill -9 -f "k3s/data/[^/]+/bin/containerd-shim-runc"
|
||||
register: pkill_containerd_shim_runc
|
||||
changed_when: "pkill_containerd_shim_runc.rc == 0"
|
||||
failed_when: false
|
||||
|
||||
- name: Umount k3s filesystems
|
||||
ansible.builtin.include_tasks: umount_with_children.yml
|
||||
with_items:
|
||||
- /run/k3s
|
||||
- /var/lib/kubelet
|
||||
- /run/netns
|
||||
- "{{ k3s_server_location }}"
|
||||
loop_control:
|
||||
loop_var: mounted_fs
|
||||
|
||||
- name: Remove service files, binaries, and data
|
||||
ansible.builtin.file:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- /usr/local/bin/k3s
|
||||
- "{{ systemd_dir }}/k3s-server.service"
|
||||
- "{{ systemd_dir }}/k3s-agent.service"
|
||||
- /etc/rancher/k3s
|
||||
- /var/lib/kubelet
|
||||
- /var/lib/rancher/k3s
|
||||
- "{{ k3s_server_location }}"
|
||||
|
||||
- name: Systemd daemon reload
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: true
|
||||
@@ -1,16 +0,0 @@
|
||||
---
|
||||
- name: Get the list of mounted filesystems
|
||||
ansible.builtin.shell: set -o pipefail && cat /proc/mounts | awk '{ print $2}' | grep -E "^{{ mounted_fs }}"
|
||||
register: get_mounted_filesystems
|
||||
args:
|
||||
executable: /bin/bash
|
||||
failed_when: false
|
||||
changed_when: get_mounted_filesystems.stdout | length > 0
|
||||
check_mode: false
|
||||
|
||||
- name: Umount filesystem
|
||||
ansible.posix.mount:
|
||||
path: "{{ item }}"
|
||||
state: unmounted
|
||||
with_items:
|
||||
"{{ get_mounted_filesystems.stdout_lines | reverse | list }}"
|
||||
Reference in New Issue
Block a user