added ext4 and bind mount types

This commit is contained in:
Beth Parker 2025-03-20 01:17:04 -05:00
parent b655bd5540
commit 237ffd5244
3 changed files with 44 additions and 10 deletions

16
tasks/bind.yml Normal file
View file

@ -0,0 +1,16 @@
# tasks file for mounting binds
- name: create bind directory
ansible.builtin.file:
path: "/var/lib/{{ item.mount }}"
state: directory
mode: '0755'
loop: "{{ bind_mounts }}"
- name: mount bind
ansible.builtin.mount:
path: "{{ item.mount }}"
src: "{{ item.src }}"
fstype: none
opts: bind
state: mounted
loop: "{{ bind_mounts }}"

View file

@ -1,4 +1,16 @@
- name: test # tasks file for mounting ext4
ansible.builtin.file: - name: mount ext4
path: /tmp/ext4-{{item.name}} ansible.builtin.mount:
state: directory path: "{{ item.mount }}"
src: "{{ item.device }}"
fstype: ext4
opts: noatime
state: mounted
loop: "{{ ext4_mounts }}"
- name: mount ext4
ansible.builtin.mount:
path: "/mnt/data/"
src: "UUID=a11c4225-bf55-4888-ab15-589afde95510"
fstype: ext4

View file

@ -3,10 +3,10 @@
- name: Set up mounts if variable is defined - name: Set up mounts if variable is defined
block: block:
# - include_tasks: ext4.yml - include_tasks: ext4.yml
# when: mounts.ext4 when: mounts.ext4 is defined
# with_items: vars:
# - mounts.ext4 ext4_mounts: "{{ mounts.ext4 }}"
- include_tasks: nfs.yml - include_tasks: nfs.yml
when: mounts.nfs is defined when: mounts.nfs is defined
@ -14,7 +14,13 @@
nfs_mounts: "{{ mounts.nfs }}" nfs_mounts: "{{ mounts.nfs }}"
# - include_tasks: sshfs.yml # - include_tasks: sshfs.yml
# loop: "{{ mounts }}" # when: mounts.sshfs is defined
# when: item == "sshfs" # vars:
# sshfs_mounts: "{{ mounts.sshfs }}"
- include_tasks: bind.yml
when: mounts.bind is defined
vars:
bind_mounts: "{{ mounts.bind }}"
when: mounts is defined when: mounts is defined