Commit ec953544 authored by Jiayi Hu's avatar Jiayi Hu
Browse files

Add Alpine reset configuration

parent d22ad01d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -28,3 +28,7 @@
    name: k3s
    state: restarted
    enabled: yes

- name: lbu
  debug:
    msg: Remember to commit changes with 'lbu ci -d' to store the k3s passwords
+5 −42
Original line number Diff line number Diff line
---
- name: Disable services
  systemd:
    name: "{{ item }}"
    state: stopped
    enabled: no
  failed_when: false
  with_items:
    - k3s
    - k3s-node

- name: 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
  loop_control:
    loop_var: mounted_fs

- name: Remove service files, binaries and data
  file:
    name: "{{ item }}"
    state: absent
  with_items:
    - "{{ systemd_dir }}/k3s.service"
    - "{{ systemd_dir }}/k3s-node.service"
    - /etc/rancher/k3s
    - /var/lib/rancher/k3s
    - /var/lib/kubelet
    - /usr/local/bin/k3s

- name: daemon_reload
  systemd:
    daemon_reload: yes
- name: Delete every service and binary
  include_tasks: "{{ item }}"
  with_first_found:
    - "prereq/{{ ansible_distribution }}.yml"
    - "prereq/default.yml"
+28 −0
Original line number Diff line number Diff line
---
- name: Disable services
  service:
    name: k3s
    state: stopped
    enabled: no

- name: Umount k3s filesystems
  include_tasks: umount_with_children.yml
  with_items:
    - /run/k3s
    - /var/lib/kubelet
    - /run/netns
    - /var/lib/rancher/k3s
  loop_control:
    loop_var: mounted_fs

- name: Remove service files, binaries and data
  file:
    name: "{{ item }}"
    state: absent
  with_items:
    - /etc/init.d/k3s
    - /etc/runlevels/default/k3s
    - /etc/rancher/k3s
    - /var/lib/rancher/k3s
    - /var/lib/kubelet
    - /usr/local/bin/k3s
+42 −0
Original line number Diff line number Diff line
---
- name: Disable services
  systemd:
    name: "{{ item }}"
    state: stopped
    enabled: no
  failed_when: false
  with_items:
    - k3s
    - k3s-node

- name: 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
  loop_control:
    loop_var: mounted_fs

- name: Remove service files, binaries and data
  file:
    name: "{{ item }}"
    state: absent
  with_items:
    - "{{ systemd_dir }}/k3s.service"
    - "{{ systemd_dir }}/k3s-node.service"
    - /etc/rancher/k3s
    - /var/lib/rancher/k3s
    - /var/lib/kubelet
    - /usr/local/bin/k3s

- name: daemon_reload
  systemd:
    daemon_reload: yes
+0 −2
Original line number Diff line number Diff line
@@ -2,8 +2,6 @@
- name: Get the list of mounted filesystems
  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