-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathclean.yml
47 lines (38 loc) · 935 Bytes
/
clean.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
- hosts: all
vars:
user_name: mac1000
tasks:
- name: Check for user {{ user_name }}
shell: dscl . read /Users/{{ user_name }}
register: user_check
failed_when: user_check.rc == -1
- name: Delete user {{ user_name }}
become: yes
shell: dscl . -delete /Users/{{ user_name }}
when: user_check.rc == 0
- name: Unmount /usr/local if it is mounted
become: yes
mount:
path: /usr/local
state: unmounted
- name: Unmount /opt/homebrew if it is mounted
become: yes
mount:
path: /opt/homebrew
state: unmounted
- name: Remove /Users/{{ user_name }}
become: yes
file:
state: absent
path: /Users/{{ user_name }}
- name: Remove /Users/busybox
become: yes
file:
state: absent
path: /Users/busybox
- name: Remove ocluster
become: yes
file:
path: "{{ ansible_env.HOME }}/ocluster"
state: absent