0

I'm trying to learn how to use puppet query, but I'm finding it difficult to target a particular fact path using regex.

If I use the following query, I get exactly what I'm looking for:

puppet-query 'inventory[certname, facts.os.family, facts.mountpoints./nfs/systems.filesystem] { facts.os.family = "RedHat" and facts.os.release.major <= "6" and facts.mountpoints./nfs/systems.filesystem = "nfs" }'

  {
    "certname": "SERVER1",
    "facts.os.family": "RedHat",
    "facts.mountpoints./nfs/systems.filesystem": "nfs"
  },
  {
    "certname": "SERVER2",
    "facts.os.family": "RedHat",
    "facts.mountpoints./nfs/systems.filesystem": "nfs"
  },
  {
    "certname": "SERVER3",
    "facts.os.family": "RedHat",
    "facts.mountpoints./nfs/systems.filesystem": "nfs"
  }
]

However, not every server is going to use the precise mount path '/nfs/systems'.

Therefore I tried to use regex instead:

puppet-query 'inventory[certname, facts.os.family, facts.mountpoints.(.*).filesystem] { facts.os.family = "RedHat" and facts.os.release.major <= "6" and facts.mountpoints(.*).filesystem = "nfs" }'

puppet doesn't complain about the syntax, but it returns nothing.

What is wrong with my syntax?

sutur
  • 1

0 Answers0