mount
Manage filesystem mounts and their fstab entries
Collection: posix
Full Name: parallax.posix.mount
Aliases: ansible.posix.mount
Synopsis
Manage filesystem mounts and their fstab entries
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| path | string | yes | Mount point path (required) | |
| src | string | Device or source to mount | ||
| fstype | string | Filesystem type (e.g., ext4, xfs, nfs) | ||
| opts | string | defaults | Mount options (comma-separated) | |
| state | string | mounted | Desired state Choices: mounted, unmounted, present, absent, remounted | |
| fstab | string | /etc/fstab | Path to fstab file | |
| boot | bool | true | Whether the filesystem should be mounted at boot | |
| backup | bool | false | Create a backup of fstab before modifying | |
| dump | string | 0 | Dump field value for fstab entry | |
| passno | string | 0 | Pass number field for fstab entry |
Example
yaml
- name: Mount an NFS share at boot
ansible.posix.mount:
path: /mnt/shared
src: nfs1.internal:/export/shared
fstype: nfs
opts: ro,soft
state: mounted