ansible.builtin.mount_facts module – Retrieve mount information.
Note
This module is part of ansible-core
and included in all Ansible
installations. In most cases, you can use the short
module name
mount_facts
even without specifying the collections keyword.
However, we recommend you use the Fully Qualified Collection Name (FQCN) ansible.builtin.mount_facts
for easy linking to the
module documentation and to avoid conflicting with other collections that may have
the same module name.
New in ansible-core 2.18
Synopsis
Retrieve information about mounts from preferred sources and filter the results based on the filesystem type and device.
Parameters
Parameter |
Comments |
---|---|
A list of fnmatch patterns to filter mounts by the special device or remote file system. |
|
A list of fnmatch patterns to filter mounts by the type of the file system. |
|
Whether or not the module should return the When this is Choices:
|
|
The Set to Default: |
|
The action to take when gathering mount information exceeds Choices:
|
|
A list of sources used to determine the mounts. Missing file sources (or empty files) are skipped. Repeat sources, including symlinks, are skipped. The Additional mounts to the same mount point are available from By default, mounts are retrieved from all of the standard locations, which have the predefined aliases
The value of |
|
This is the maximum number of seconds to wait for each mount to complete. When this is Configure in conjunction with This timeout also applies to the If the module is configured to run during the play’s fact gathering stage, set a timeout using module_defaults to prevent a hang (see example). |
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in check_mode and return changed status prediction without modifying target, if not supported the action will be skipped. |
|
Support: none |
Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode |
|
Platform: posix |
Target OS/families that can be operated against |
Examples
- name: Get non-local devices
mount_facts:
devices: "[!/]*"
- name: Get FUSE subtype mounts
mount_facts:
fstypes:
- "fuse.*"
- name: Get NFS mounts during gather_facts with timeout
hosts: all
gather_facts: true
vars:
ansible_facts_modules:
- ansible.builtin.mount_facts
module_default:
ansible.builtin.mount_facts:
timeout: 10
fstypes:
- nfs
- nfs4
- name: Get mounts from a non-default location
mount_facts:
sources:
- /usr/etc/fstab
- name: Get mounts from the mount binary
mount_facts:
sources:
- mount
mount_binary: /sbin/mount