From 237ffd524466460e7eab3f71856c0bb198fcf7b1 Mon Sep 17 00:00:00 2001 From: Beth Date: Thu, 20 Mar 2025 01:17:04 -0500 Subject: [PATCH] added ext4 and bind mount types --- tasks/bind.yml | 16 ++++++++++++++++ tasks/ext4.yml | 20 ++++++++++++++++---- tasks/main.yml | 18 ++++++++++++------ 3 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 tasks/bind.yml diff --git a/tasks/bind.yml b/tasks/bind.yml new file mode 100644 index 0000000..d6fcf37 --- /dev/null +++ b/tasks/bind.yml @@ -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 }}" \ No newline at end of file diff --git a/tasks/ext4.yml b/tasks/ext4.yml index e30c229..b5dbfd9 100644 --- a/tasks/ext4.yml +++ b/tasks/ext4.yml @@ -1,4 +1,16 @@ -- name: test - ansible.builtin.file: - path: /tmp/ext4-{{item.name}} - state: directory +# tasks file for mounting ext4 +- name: mount ext4 + ansible.builtin.mount: + 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 \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index 701a016..bb28389 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -3,10 +3,10 @@ - name: Set up mounts if variable is defined block: -# - include_tasks: ext4.yml -# when: mounts.ext4 -# with_items: -# - mounts.ext4 + - include_tasks: ext4.yml + when: mounts.ext4 is defined + vars: + ext4_mounts: "{{ mounts.ext4 }}" - include_tasks: nfs.yml when: mounts.nfs is defined @@ -14,7 +14,13 @@ nfs_mounts: "{{ mounts.nfs }}" # - include_tasks: sshfs.yml -# loop: "{{ mounts }}" -# when: item == "sshfs" +# when: mounts.sshfs is defined +# vars: +# sshfs_mounts: "{{ mounts.sshfs }}" + + - include_tasks: bind.yml + when: mounts.bind is defined + vars: + bind_mounts: "{{ mounts.bind }}" when: mounts is defined