make reset work with alt k3s dir and root user (#265)

* make reset work with alt k3s dir and root user

Signed-off-by: gmautner <gilberto.mautner@locaweb.com.br>
Signed-off-by: Gilberto Mautner <gilberto.mautner@locaweb.com.br>

* Added changed_when
Signed-off-by: gmautner <gilberto.mautner@locaweb.com.br>

Signed-off-by: Gilberto Mautner <gilberto.mautner@locaweb.com.br>

* Checks if we removed alt dir contents

Co-authored-by: Derek Nola <derek.nola@suse.com>
Signed-off-by: Gilberto Mautner <gilberto.mautner@locaweb.com.br>

---------

Signed-off-by: gmautner <gilberto.mautner@locaweb.com.br>
Signed-off-by: Gilberto Mautner <gilberto.mautner@locaweb.com.br>
Co-authored-by: Derek Nola <derek.nola@suse.com>
This commit is contained in:
Gilberto Mautner 2023-12-01 19:34:44 -03:00 committed by GitHub
parent ec02f1cafd
commit b4237ef24d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -15,9 +15,14 @@
removes: /var/lib/rancher/k3s/*
- name: Remove user kubeconfig
ansible.builtin.file:
path: /home/{{ ansible_user }}/.kube/config
path: ~{{ ansible_user }}/.kube/config
state: absent
- name: Remove k3s install script
ansible.builtin.file:
path: /usr/local/bin/k3s-install.sh
state: absent
- name: Remove contents of K3s server location
when: k3s_server_location is defined
ansible.builtin.shell:
cmd: "rm -rf {{ k3s_server_location }}/*"
removes: "{{ k3s_server_location }}/*"