aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'roles/install_gentoo/tasks/late-mount.yml')
-rw-r--r--roles/install_gentoo/tasks/late-mount.yml30
1 files changed, 30 insertions, 0 deletions
diff --git a/roles/install_gentoo/tasks/late-mount.yml b/roles/install_gentoo/tasks/late-mount.yml
new file mode 100644
index 0000000..cc36d99
--- /dev/null
+++ b/roles/install_gentoo/tasks/late-mount.yml
@@ -0,0 +1,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
+