Using External Facts to push server- side crafted data to nodes?

asked 2018-04-06 08:02:04 -0600

V4LD3R5 gravatar image


I have the following scenario:

  • One custom fact which returns a hash
  • To build this hash, I feed an array to the custom fact. Its values will become the hash keys

Now here is the problem: I build this array inside my module. The only way I found to work around this is by creating a new, external fact, which I populate as follows:

  • create a new template inside the module, which will be dynamically filled in by using my module's variables
  • the resulting would be a YAML file loaded into: /opt/puppetlabs/facter/facts.d/my_file.yaml
  • the content of this YAML file is just the array I need, generated from server-side data

Am I doing it right? Is there any other way to do this more easily? Thanks

edit retag flag offensive close merge delete


forgot to mention I'm already making use of it and works perfectly, but I wonder if it's maybe too complex...

V4LD3R5 gravatar imageV4LD3R5 ( 2018-04-06 09:43:42 -0600 )edit