From b6cc83ad8205c64ba0504f9aee899b6afc460bbd Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Sun, 1 Sep 2024 08:54:08 -0500 Subject: [PATCH] datavol: Support creating btrfs subvolumes Set the `btrfs_subvolumes` variable to an array of objects with `name` and `device` properties to create btrfs subvolumes. --- datavol.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/datavol.yml b/datavol.yml index 6c0bf09..897d177 100644 --- a/datavol.yml +++ b/datavol.yml @@ -29,6 +29,21 @@ tags: - mkfs + - name: ensure btrfs subvolumes exist + community.general.btrfs_subvolume: + name: '{{ item.name }}' + filesystem_device: '{{ item.device }}' + automount: true + loop: '{{ btrfs_subvolumes|d([]) }}' + tags: + - btrfs + + - name: ensure mount point exists + file: + path: '{{ item.mountpoint }}' + state: directory + loop: '{{ data_volumes|d([]) }}' + - name: ensure data volume is mounted mount: path: '{{ item.mountpoint }}'