saranyasridharan.diskinfo.disk_info (1.0.2) — module

Retrieves disk info

| "added in version" 1.0.2 of saranyasridharan.diskinfo"

Authors: Saranya Sridharan (@saranyasridharan)

Install collection

Install with ansible-galaxy collection install saranyasridharan.diskinfo:==1.0.2


Add to requirements.yml

  collections:
    - name: saranyasridharan.diskinfo
      version: 1.0.2

Description

This module retrieves disk info like free space, used percentage, mount location, and so on.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Get disk info
  community.general.disk_info:
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Get Disk info for Particular disk info
  community.general.disk_info:
    name: /dev/sda
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Filter the output parameters for specific disk
  community.general.disk_info:
    name: /dev/md0
    filter:
      - mountpoint
      - freespace
      - totalsize
      - inode_used
      - inode_total
      - inode_free
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Filter the output parameters for all disk
  community.general.disk_info:
    filter:
      - fstype
      - usedspace
      - capacity_percentage

Inputs

    
name:
    description:
    - This is the disk device name to query.
    - If this parameter is not passed, information on all disks are returned.
    type: str

filter:
    choices:
    - freespace
    - usedspace
    - totalsize
    - mountpoint
    - fstype
    - capacity_percent
    - inode_free
    - inode_used
    - inode_total
    description:
    - When specified, will limit the information returned to the keys specified here.
    elements: str
    type: list

Outputs

disk_info:
  contains:
    capacity_percentage:
      description: Used capacity percentage of the particular disk.
      returned: when I(filter) is not specified, or when I(filter) contains C(capacity_percentage)
      sample: 3.1
      type: float
    freespace:
      description: Free space in bytes of the particular disk.
      returned: when I(filter) is not specified, or when I(filter) contains C(freespace)
      sample: 351641169920
      type: int
    fstype:
      description: Filesystem of the particular disk.
      returned: when I(filter) is not specified, or when I(filter) contains C(fstype)
      sample: apfs
      type: str
    inode_free:
      description: Free inode space in bytes of the particular disk.
      returned: when I(filter) is not specified, or when I(filter) contains C(inode_free)
      sample: 2958330
      type: int
    inode_total:
      description: Total inode space in bytes of the particular disk.
      returned: when I(filter) is not specified, or when I(filter) contains C(inode_total)
      sample: 3907584
      type: int
    inode_used:
      description: Used inode space in bytes of the particular disk.
      returned: when I(filter) is not specified, or when I(filter) contains C(inode_used)
      sample: 949254
      type: int
    mountpoint:
      description: Mountpoint of the particular disk.
      returned: when I(filter) is not specified, or when I(filter) contains C(mountpoint)
      sample: /
      type: str
    totalsize:
      description: Size in bytes of the particular disk.
      returned: when I(filter) is not specified, or when I(filter) contains C(totalsize)
      sample: 499963174912
      type: int
    usedspace:
      description: Used space in bytes of the particular disk.
      returned: when I(filter) is not specified, or when I(filter) contains C(usedspace)
      sample: 11198701568
      type: int
  description: Retrieves disk info, if filter option is given retrieves only filtered
    values like freespace, totalsize and so on.
  returned: success
  type: dict