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

时间:2017-05-24 04:59:40

标签: filesystems puppet 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等)

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

1 个答案:

答案 0 :(得分:2)

要访问哈希值,请使用$hash_name['key name'],因此请使用$facts,访问mountpoints密钥,然后访问/密钥,再访问filesystem按键顺序:

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

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