mount
Collection: builtin
Full Name: parallax.builtin.mount
Aliases: ansible.builtin.mount, mount
Synopsis
Manage filesystem mounts and their fstab entries
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| src | string | Device to mount, or for bind mounts the directory to bind | ||
| path | string | yes | Mount point | |
| fstype | string | Filesystem type for mount operation | ||
| state | string | mounted | Mount state Choices: absent, ephemeral, mounted, present, remounted, unmounted | |
| opts | string | Mount options (comma-separated) | ||
| passno | int | 0 | Passno field in /etc/fstab | |
| dump | int | 0 | Dump field in /etc/fstab | |
| fstab | string | /etc/fstab | Path to fstab file | |
| backup | bool | false | Create backup of fstab before making changes | |
| boot | bool | true | Determines if filesystem should be mounted at boot time | |
| ephemeral | bool | false | Mount without adding entry to fstab | |
| force | bool | false | Force unmount (with -f flag) | |
| lazy | bool | false | Lazy unmount (with -l flag) | |
| mkdir | bool | true | Create mount point directory if it doesn’t exist | |
| mode | string | Mode for created mount point directory | ||
| owner | string | Owner for created mount point directory | ||
| group | string | Group 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