mount

Collection: builtin

Full Name: parallax.builtin.mount

Aliases: ansible.builtin.mount, mount

Synopsis

Manage filesystem mounts and their fstab entries

Parameters

NameTypeRequiredDefaultDescription
srcstringDevice to mount, or for bind mounts the directory to bind
pathstringyesMount point
fstypestringFilesystem type for mount operation
statestringmountedMount state Choices: absent, ephemeral, mounted, present, remounted, unmounted
optsstringMount options (comma-separated)
passnoint0Passno field in /etc/fstab
dumpint0Dump field in /etc/fstab
fstabstring/etc/fstabPath to fstab file
backupboolfalseCreate backup of fstab before making changes
bootbooltrueDetermines if filesystem should be mounted at boot time
ephemeralboolfalseMount without adding entry to fstab
forceboolfalseForce unmount (with -f flag)
lazyboolfalseLazy unmount (with -l flag)
mkdirbooltrueCreate mount point directory if it doesn’t exist
modestringMode for created mount point directory
ownerstringOwner for created mount point directory
groupstringGroup for created mount point directory

Example

- name: Mount the data volume and record it in fstab
  mount:
    path: /srv/data
    src: /dev/disk/by-label/data
    fstype: ext4
    opts: defaults,noatime
    state: mounted