Red Hat Training
A Red Hat training course is available for RHEL 8
Chapter 47. Creating and mounting ext4 file systems using RHEL System Roles
This section describes how to create an ext4 file system with a given label on a disk, and persistently mount the file system using the storage
role.
Prerequisites
-
An Ansible playbook including the
storage
role exists.
47.1. Example Ansible playbook to create and mount an Ext4 file system
This section provides an example Ansible playbook. This playbook applies the storage
role to create and mount an Ext4 file system.
Example 47.1. A playbook that creates Ext4 on /dev/sdb and mounts it at /mnt/data
--- - hosts: all vars: storage_volumes: - name: barefs type: disk disks: - sdb fs_type: ext4 fs_label: label-name mount_point: /mnt/data roles: - rhel-system-roles.storage
-
The playbook creates the file system on the
/dev/sdb
disk. -
The playbook persistently mounts the file system at the
/mnt/data
directory. -
The label of the file system is
label-name
.
Additional resources
-
The
/usr/share/ansible/roles/rhel-system-roles.storage/README.md
file.
47.2. Additional resources
-
For more information about the
storage
role, see - Introduction to the storage role