Documentation

    PLEASE NOTE: This document applies to v2.18 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.

    filesystem

    Create filesystems on block devices.

    Attributes

    check_mode:
      support: full
    

    Parameters

    Parameter Required Type Values Description
    dev true string   Target block device path.
    force   boolean   Force filesystem creation even if the device already has a filesystem. [default: false]
    fstype true string ext4
    ext3
    ext2
    xfs
    btrfs
    vfat
    swap
    Filesystem type to create.
    opts   string   Additional options to pass to the mkfs command.

    Example

    - name: Create ext4 filesystem
      filesystem:
        dev: /dev/sdb1
        fstype: ext4
    
    - name: Create xfs filesystem with force
      filesystem:
        dev: /dev/sdc1
        fstype: xfs
        force: true
    
    - name: Create btrfs filesystem with options
      filesystem:
        dev: /dev/sdd1
        fstype: btrfs
        opts: -L mydata