filesystemspuppetfacter

Puppet get / partition filesystem type using facter


I want to determine which filesystem type the / partition has.

facter mountpoints shows:

/home => {
  available => "1.81 GiB",
  available_bytes => 1946107904,
  capacity => "2.01%",
  device => "/dev/sda/home",
  filesystem => "xfs",
  options => [
    "rw",
    "relatime",
    "attr2",
    "inode64",
    "noquota"
  ],
  size => "1.85 GiB",
  size_bytes => 1986002944,
  used => "38.05 MiB",
  used_bytes => 39895040
},

I want only the filesystem type (like xfs,ext2, etc.)

What should the hash access look like?


Solution

  • To access values in a hash, use $hash_name['key name'], so use $facts, access the mountpoints key, then the / key, then the filesystem key in order:

    $root_filesystem = $facts['mountpoints']['/']['filesystem']
    

    More information: Puppet language: Hashes: Accessing values.