aboutsummaryrefslogtreecommitdiff
blob: cc36d998148f845a6c1a105b0f6b95f8e9d6a9aa (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
---  
- name: late-mount
  tags:
    - mount
    - late-mount
  block:
  - name: stat /dev/shm
    ansible.builtin.stat:
      path: /dev/shm
      follow: false # explicitly; we need this to NOT be a link
    register: stat_dev_shm
  
  - name: fix /dev/shm
    ansible.builtin.shell: >
      rm -f /dev/shm && mkdir /dev/shm && mount --types tmpfs --options nosuid,nodev,noexec shm /dev/shm && chmod 1777 /dev/shm /run/shm
    when: not stat_dev_shm.stat.exists or stat_dev_shm.stat.islnk
  
  - name: virtual.fstab
    ansible.builtin.copy:
      dest: /tmp/virtual.fstab
      content: |
        /proc {{ chroot }}/proc proc rw,relatime 0 0
        /sys {{ chroot }}/sys bind rbind,rslave 0 0
        /dev {{ chroot }}/dev bind rbind,rslave 0 0
        /run {{ chroot }}/run bind bind,slave 0 0
  
  - name: mount virtual
    # TODO: how to safely check if this is needed at all?
    ansible.builtin.command: mount -T /tmp/virtual.fstab -a