Explorar el Código

Improve mounting.

next_step
Luigi Cruz hace 3 años
padre
commit
764cbfe0f2
Se han modificado 2 ficheros con 18 adiciones y 6 borrados
  1. +17
    -4
      ansible/tasks/mount.yaml
  2. +1
    -2
      ansible/tasks/umount.yaml

+ 17
- 4
ansible/tasks/mount.yaml Ver fichero

@@ -2,7 +2,20 @@
- name: Mount pseudo filesystems - name: Mount pseudo filesystems
connection: local connection: local
shell: | shell: |
mount -o bind,ro /dev {{ lookup('env', 'ANSIBLE_ROOTFS_DIR') }}/dev
mount -o bind,ro /dev/pts {{ lookup('env', 'ANSIBLE_ROOTFS_DIR') }}/dev/pts
mount -t proc none {{ lookup('env', 'ANSIBLE_ROOTFS_DIR') }}/proc
mount -t sysfs none {{ lookup('env', 'ANSIBLE_ROOTFS_DIR') }}/sys
ROOTFS_DIR={{ lookup('env', 'ANSIBLE_ROOTFS_DIR') }}

if grep -q "$(realpath "${ROOTFS_DIR}"/proc)"; then
mount -t proc proc "${ROOTFS_DIR}/proc"
fi

if grep -q "$(realpath "${ROOTFS_DIR}"/dev)"; then
mount --bind /dev "${ROOTFS_DIR}/dev"
fi
if grep -q "$(realpath "${ROOTFS_DIR}"/dev/pts)"; then
mount --bind /dev/pts "${ROOTFS_DIR}/dev/pts"
fi

if grep -q "$(realpath "${ROOTFS_DIR}"/sys)"; then
mount --bind /sys "${ROOTFS_DIR}/sys"
fi

+ 1
- 2
ansible/tasks/umount.yaml Ver fichero

@@ -1,8 +1,7 @@
--- ---
- name: Umount pseudo filesystems - name: Umount pseudo filesystems
connection: local connection: local
shell: umount -l '{{ lookup('env', 'ANSIBLE_ROOTFS_DIR') }}{{ item }}'
ignore_errors: yes
shell: umount '{{ lookup('env', 'ANSIBLE_ROOTFS_DIR') }}{{ item }}'
with_items: with_items:
- /proc - /proc
- /dev/pts - /dev/pts


Cargando…
Cancelar
Guardar