Puppet 使用 facter 获取/分区文件系统类型

Puppet get / partition filesystem type using facter

我想确定 / 分区的文件系统类型。

facter mountpoints 显示:

/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
},

我只想要文件系统类型(如 xfs、ext2 等)

哈希访问应该是什么样的?

要访问散列中的值,请使用 $hash_name['key name'],因此请使用 $facts,访问 mountpoints 键,然后是 / 键,然后是 filesystem 按顺序键:

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

更多信息:Puppet language: Hashes: Accessing values