aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2024-02-24 13:31:20 -0800
committerRobin H. Johnson <robbat2@gentoo.org>2024-02-24 13:31:20 -0800
commit775d90c41747132f134d301ca3acf2ebb1fe8f97 (patch)
tree2a19282d9cdb5dd944733c91fd3d242cd7190efb
parentfix(group_vars): ease puppet work (diff)
downloadansible-775d90c41747132f134d301ca3acf2ebb1fe8f97.tar.gz
ansible-775d90c41747132f134d301ca3acf2ebb1fe8f97.tar.bz2
ansible-775d90c41747132f134d301ca3acf2ebb1fe8f97.zip
install_gentoo: split mounts
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rw-r--r--roles/install_gentoo/tasks/early-mount.yml (renamed from roles/install_gentoo/tasks/mount.yml)7
-rw-r--r--roles/install_gentoo/tasks/install.yml23
-rw-r--r--roles/install_gentoo/tasks/late-mount.yml30
-rw-r--r--roles/install_gentoo/tasks/main.yml8
4 files changed, 44 insertions, 24 deletions
diff --git a/roles/install_gentoo/tasks/mount.yml b/roles/install_gentoo/tasks/early-mount.yml
index 74672cb..ba65856 100644
--- a/roles/install_gentoo/tasks/mount.yml
+++ b/roles/install_gentoo/tasks/early-mount.yml
@@ -5,11 +5,13 @@
state: directory
tags:
- mount
+ - early-mount
- name: mount /
ansible.builtin.command: "mount /dev/{{ vgs }}/rootfs /mnt/gentoo"
tags:
- mount
+ - early-mount
- name: mkdir /mnt/gentoo/boot
ansible.builtin.file:
@@ -17,11 +19,13 @@
state: directory
tags:
- mount
+ - early-mount
- name: mount /boot
ansible.builtin.command: "mount LABEL=BOOT /mnt/gentoo/boot"
tags:
- mount
+ - early-mount
- name: mkdir /mnt/gentoo/boot/efi
ansible.builtin.file:
@@ -29,11 +33,13 @@
state: directory
tags:
- mount
+ - early-mount
- name: mount /boot/efi
ansible.builtin.command: "mount LABEL=EFI /mnt/gentoo/boot/efi"
tags:
- mount
+ - early-mount
- name: mkdir /mnt/gentoo/tmp
ansible.builtin.file:
@@ -42,3 +48,4 @@
mode: '01777'
tags:
- mount
+ - early-mount
diff --git a/roles/install_gentoo/tasks/install.yml b/roles/install_gentoo/tasks/install.yml
index c083e0f..9c89f16 100644
--- a/roles/install_gentoo/tasks/install.yml
+++ b/roles/install_gentoo/tasks/install.yml
@@ -35,29 +35,6 @@
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844
- - 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
- name: /etc/portage/repos.conf/gentoo.conf
ansible.builtin.copy:
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
+
diff --git a/roles/install_gentoo/tasks/main.yml b/roles/install_gentoo/tasks/main.yml
index b528285..7d477c5 100644
--- a/roles/install_gentoo/tasks/main.yml
+++ b/roles/install_gentoo/tasks/main.yml
@@ -8,14 +8,20 @@
- disks
- mount
-- include_tasks: mount.yml
+- include_tasks: early-mount.yml
tags:
- mount
+ - early-mount
- include_tasks: rootfs.yml
tags:
- rootfs
+- include_tasks: late-mount.yml
+ tags:
+ - mount
+ - late-mount
+
- include_tasks: install.yml
tags:
- install