mount - Control active and configured mount points¶
Parameters¶
Parameter | Choices/Defaults | Comments |
---|---|---|
backup
bool (added in 2.5) |
|
Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.
|
boot
bool (added in 2.2) |
|
Determines if the filesystem should be mounted on boot.
Only applies to Solaris systems.
|
dump |
Default: 0
|
Dump (see fstab(5)). Note that if set to
null and state set to present , it will cease to work and duplicate entries will be made with subsequent runs.Has no effect on Solaris systems.
|
fstab |
Default: /etc/fstab (/etc/vfstab on Solaris)
|
File to use instead of
/etc/fstab . You shouldn't use this option unless you really know what you are doing. This might be useful if you need to configure mountpoints in a chroot environment. OpenBSD does not allow specifying alternate fstab files with mount so do not use this on OpenBSD with any state that operates on the live filesystem. |
fstype |
Filesystem type. Required when state is
present or mounted . |
|
opts |
Mount options (see fstab(5), or vfstab(4) on Solaris).
|
|
passno |
Default: 0
|
Passno (see fstab(5)). Note that if set to
null and state set to present , it will cease to work and duplicate entries will be made with subsequent runs.Deprecated on Solaris systems.
|
path
required |
Path to the mount point (e.g.
/mnt/files ).Before 2.3 this option was only usable as dest, destfile and name.
aliases: name |
|
src |
Device to be mounted on path. Required when state set to
present or mounted . |
|
state
required |
|
If
mounted , the device will be actively mounted and appropriately configured in fstab. If the mount point is not present, the mount point will be created.If
unmounted , the device will be unmounted without changing fstab.present only specifies that the device is to be configured in fstab and does not trigger or require a mount.absent specifies that the device mount's entry will be removed from fstab and will also unmount the device and remove the mount point. |
Notes¶
Note
- As of Ansible 2.3, the name option has been changed to path as default, but name still works as well.
Examples¶
# Before 2.3, option 'name' was used instead of 'path'
- name: Mount DVD read-only
mount:
path: /mnt/dvd
src: /dev/sr0
fstype: iso9660
opts: ro,noauto
state: present
- name: Mount up device by label
mount:
path: /srv/disk
src: LABEL=SOME_LABEL
fstype: ext4
state: present
- name: Mount up device by UUID
mount:
path: /home
src: UUID=b3e48f45-f933-4c8e-a700-22a159ec9077
fstype: xfs
opts: noatime
state: present
Status¶
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Maintenance¶
This module is flagged as core which means that it is maintained by the Ansible Core Team. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Core Team, see here.
Support¶
For more information about Red Hat’s support of this module, please refer to this Knowledge Base article
Author¶
- Ansible Core Team
- Seth Vidal
Hint
If you notice any issues in this documentation you can edit this document to improve it.