Commit Graph

6 Commits (713fd794a3acc4ed31e7ce910a5c3b10dacdd75b)

Author SHA1 Message Date
Dustin bf33c2ab7c datavol: Handle undefined logical_volumes
This fixes an `Unable to look up a name or access an atribute in
template string` error when applying the `datavol.yml` playbook for a
machine that does not define any LVM logical volumes.
2025-07-28 16:51:04 -05:00
Dustin 93553c7630 datavol: Add support for LVM
The `datavol.yml` playbook can now create LVM volume groups and logical
volumes.  This will be useful for physical hosts with static storage.

LVM LVs and VGs are defined using the `logical_volumes` Ansible
variable, which contains a mapping of VG names to their properties.
Each VG must have two properties: `pvs`, which is a list of LVM physical
volumes to add to the VG, and `lvs`, a list of LVs and their properties,
including `name` and `size.  For example:

```yaml
logical_volumes:
  kubernetes:
    pvs:
    - /dev/nvme0n1
    lvs:
    - name: containers
      size: 64G
    - name: kubelet
      size: 32G
```
2025-07-27 12:37:23 -05:00
Dustin 0393f074a4 host-setup: Import datavol Playbook
The `host-setup.yml` playbook now imports the `datavol.yml` playbook, so
that new machines (particularly those provisioned by the
host-provisioner) get their data volumes formatted and mounted
automatically.
2025-07-12 16:45:47 -05:00
Dustin b6cc83ad82 datavol: Support creating btrfs subvolumes
Set the `btrfs_subvolumes` variable to an array of objects with `name`
and `device` properties to create btrfs subvolumes.
2024-09-01 08:59:28 -05:00
Dustin 9ae88a5f36 datavol: Only set SELinux label of root directory
Restoring the SELinux label of a mount point is really only necessary
for a band new filesystem, which will have no label at all.  In other
cases, changing the context is probably neither necessary nor desirable,
as the existing data is potentially labelled correctly already.
Changing the label on on only the root directory should be sufficient to
ensure applications run correctly with newly-provisioned filesystems,
since they only have one directory anyway, without impacting too much
for existing filesystems.
2024-08-12 22:22:50 -05:00
Dustin 54ad68b5bb datavol: Playbook to provision a data volume
The `datavol.yml` playbook can provision one or more data volumes on
a managed node, using the definitions in the `data_volumes` variable.
This variable must contain a list of dictionaries with the following
keys:

* `dev`: The block device where the data volume is stored (e.g.
  `/dev/vdb`)
* `fstype`: The type of filesystem to create on the block device
* `mountpoint`: The location in the filesystem hierarchy where the
  volume is mounted
* `opts`: (Optional) options to pass to the `mkfs` program when
  formatting the device
* `mountopts`: (Optional) additional options to pass to the `mount`
  program when mounting the filesystem
2024-07-02 20:44:29 -05:00