summaryrefslogtreecommitdiff
path: root/roles/unmount-all/tasks/main.yml
blob: e097b2bea854c036481c777a8d9102be645d23f4 (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Unmount all mounts
# If remove unmounted before absent, cannot unmount vyos_install_root...
- name: Unmount {{ vyos_install_root }}/boot
  become: true
  mount:
    name: "{{ vyos_install_root }}/boot"
    src: "{{ vyos_write_root }}"
    fstype: none
    state: unmounted

- name: Unmount {{ vyos_install_root }}/boot
  become: true
  mount:
    name: "{{ vyos_install_root }}/boot"
    src: "{{ vyos_write_root }}"
    fstype: none
    state: absent

- name: Unmount {{ vyos_install_root }}/sys, {{ vyos_install_root }}/proc, {{ vyos_install_root }}/dev
  become: true
  mount:
    name: "{{ vyos_install_root }}/{{ item }}"
    src: "/{{ item }}"
    fstype: none
    state: unmounted
  with_items: [ 'sys', 'proc', 'dev' ]

- name: Unmount {{ vyos_install_root }}/sys, {{ vyos_install_root }}/proc, {{ vyos_install_root }}/dev
  become: true
  mount:
    name: "{{ vyos_install_root }}/{{ item }}"
    src: "/{{ item }}"
    fstype: none
    state: absent
  with_items: [ 'sys', 'proc', 'dev' ]

- name: Unmount {{ vyos_install_root }}
  become: true
  mount:
    name: "{{ vyos_install_root }}"
    src: overlayfs
    fstype: overlayfs
    state: absent

- name: Unmount {{ vyos_read_root }}
  become: true
  mount:
    name: "{{ vyos_read_root }}"
    src: "{{ vyos_write_root }}/boot/{{ vyos_version }}/{{ vyos_version }}.squashfs"
    fstype: squashfs
    state: absent

- name: Unmount {{ vyos_write_root }}
  become: true
  mount:
    name: "{{ vyos_write_root }}"
    src: "{{ vyos_target_drive }}"
    fstype: "{{ vyos_root_fstype }}"
    state: absent

- name: Detach {{ vyos_target_drive }}
  become: true
  command: "losetup -d {{ vyos_target_drive }}"

- name: Unmount {{ vyos_cd_squash_root }}
  become: true
  mount:
    name: "{{ vyos_cd_squash_root }}"
    src: "{{ vyos_squashfs_image }}"
    fstype: squashfs
    state: absent

- name: Unmount {{ vyos_cd_root }}
  become: true
  mount:
    name: "{{ vyos_cd_root }}"
    src: "{{ vyos_iso_local }}"
    fstype: iso9660
    state: absent