Red Hat Training

A Red Hat training course is available for RHEL 8

Chapter 31. Persistently mounting a file system using RHEL System Roles

This section describes how to persistently mount a file system using the storage role.


  • An Ansible playbook that uses the storage role exists.

31.1. Example Ansible playbook to persistently mount a file system

This section provides an example Ansible playbook. This playbook applies the storage role to immediately and persistently mount an XFS file system.

Example 31.1. A playbook that mounts a file system on /dev/sdb to /mnt/data

- hosts: all
      - name: barefs
        type: disk
          - sdb
        fs_type: xfs
        mount_point: /mnt/data
  • This playbook adds the file system to the /etc/fstab file, and mounts the file system immediately.
  • If the file system on the /dev/sdb device or the mount point directory do not exist, the playbook creates them.

Additional resources

  • The /usr/share/ansible/roles/ file.

31.2. Additional resources