CertGrid CertGrid
Hands-on Lab·Ansible

Ansible Filesystems, LVM and Persistent Mounts

Storage is the part of the RHCSA-style objectives that people practise least, because getting it wrong on a real disk is expensive. A loop device removes that risk entirely: it is a file that behaves like a block device, so the whole stack - PV, VG, LV, filesystem, mount, fstab - can be built and torn down safely.

Automating Administration Guide 32 of 45 Advanced

Written against the versions above. This lab is Ubuntu 26.04 and EX294 is a RHEL exam. LVM and the modules used here are identical on both. The modules come from collections rather than ansible-core: `community.general.lvg`, `lvol` and `filesystem`, and `ansible.posix.mount`. All ship with the `ansible` package; on a bare `ansible-core` install they must be installed.

The `db` host, which gets a 256MB loop device, an LVM stack on top of it, and a mount at /mnt/appdata. All of it is removed at the end.
Server NameIP AddressOSRolesCPURAMHDD
ANS-CTL01192.168.0.36Ubuntu 26.04 LTSAnsible Control Node2 Core3 GB50 GB
ANS-B01192.168.0.38Ubuntu 26.04 LTSManaged Node (group: db)2 Core3 GB50 GB

Before you start

  1. The configuration this guide assumes

  2. A disk that is really a file

  3. LVM on top of it

  4. What landed

  5. The four mount states

Official sources