Documentation
PLEASE NOTE: This document applies to latest version and not to the latest stable release v2.19
Documentation for other releases can be found by using the version selector in the top right of any doc page.mount
Control filesystem mounts.
Attributes
check_mode:
support: full
Parameters
| Parameter | Required | Type | Values | Description |
|---|---|---|---|---|
| fstype | string | Filesystem type. Required when state is mounted. | ||
| opts | string | Mount options. | ||
| path | true | string | Path to the mount point. | |
| src | string | Device to be mounted on path. Required when state is mounted. | ||
| state | string | absent mounted unmounted remounted |
State of the mount point. If mounted, the device will be actively mounted. If unmounted, the device will be unmounted without modifying fstab. If absent, the mount point will be unmounted and removed from fstab (fstab not yet supported). If remounted, the mount point will be remounted. [default: "mounted"] |
Example
- name: Mount data volume
mount:
path: /mnt/data
src: /dev/sdb1
fstype: ext4
state: mounted
- name: Unmount data volume
mount:
path: /mnt/data
state: unmounted
- name: Mount NFS share
mount:
path: /mnt/nfs
src: 192.168.1.100:/export/data
fstype: nfs
opts: rw,hard,intr
state: mounted
- name: Remount with new options
mount:
path: /mnt/data
state: remounted
- name: Get mount info
mount:
path: /mnt/data
state: mounted
register: mount_info