W3cubDocs

/Ansible

filesystem - Makes file system on block device

Synopsis

  • This module creates file system.

Options

parameter required default choices comments
dev
yes
Target block device.
force
no no
  • yes
  • no
If yes, allows to create new filesystem on devices that already has filesystem.
fstype
yes
File System type to be created.
reiserfs support was added in 2.2.
opts
no
List of options to be passed to mkfs command.
resizefs
(added in 2.0)
no no
  • yes
  • no
If yes, if the block device and filessytem size differ, grow the filesystem into the space. Note, XFS Will only grow if mounted.

Examples

# Create a ext2 filesystem on /dev/sdb1.
- filesystem:
    fstype: ext2
    dev: /dev/sdb1

# Create a ext4 filesystem on /dev/sdb1 and check disk blocks.
- filesystem:
    fstype: ext4
    dev: /dev/sdb1
    opts: -cc

Notes

Note

  • uses mkfs command

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/filesystem_module.html