community.general.filesystem – Makes a filesystem
community.general.filesystem – Makes a filesystem
Note
This plugin is part of the community.general collection (version 1.3.2).
To install it use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.filesystem
.
Synopsis
- This module creates a filesystem.
Requirements
The below requirements are needed on the host that executes this module.
- Uses tools related to the fstype (
mkfs
) andblkid
command. When resizefs is enabled,blockdev
command is required too.
Parameters
Parameter | Choices/Defaults | Comments |
---|---|---|
dev path / required |
Target path to device or image file.
| |
force boolean |
|
If |
fstype string |
|
Filesystem type to be created. This option is required with reiserfs support was added in 2.2. lvm support was added in 2.5. since 2.5, dev can be an image file. vfat support was added in 2.5 ocfs2 support was added in 2.6 f2fs support was added in 2.7 swap support was added in 2.8
|
opts string |
List of options to be passed to mkfs command. | |
resizefs boolean |
|
If Supported for XFS Will only grow if mounted. Currently, the module is based on commands from vFAT will likely fail if fatresize < 1.04. |
state string added in 1.3.0 of community.general |
|
If If When
|
Notes
Note
- Potential filesystem on dev are checked using
blkid
, in caseblkid
isn’t able to detect an existing filesystem, this filesystem is overwritten even if force isno
. - This module supports check_mode.
Examples
- name: Create a ext2 filesystem on /dev/sdb1
community.general.filesystem:
fstype: ext2
dev: /dev/sdb1
- name: Create a ext4 filesystem on /dev/sdb1 and check disk blocks
community.general.filesystem:
fstype: ext4
dev: /dev/sdb1
opts: -cc
- name: Blank filesystem signature on /dev/sdb1
community.general.filesystem:
dev: /dev/sdb1
state: absent
Authors
- Alexander Bulimov (@abulimov)
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/community/general/filesystem_module.html