Discussion:
[Puppet Users] Elegant way to supply facts to `puppet apply`
Abhijeet Rastogi
2018-11-23 02:27:53 UTC
Permalink
Hi everyone,


puppet lookup command has a nice --facts option which accepts a structured
json/yaml file to upload files.

Why does that option not exist for puppet apply? Is the environment
variable the only option?

Puppet version: 6.0.4

Thanks,
Abhijeet
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/c9c7ea63-cd97-4dbc-9c45-ee78e5cb9d4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Henrik Lindberg
2018-11-26 19:14:08 UTC
Permalink
Post by Abhijeet Rastogi
Hi everyone,
puppet lookup command has a nice --facts option which accepts a
structured json/yaml file to upload files.
Why does that option not exist for puppet apply? Is the environment
variable the only option?
There is a way to make it read other facts than the default getting the
facts for the node apply is running on. To use that you need to change
the facts terminus setting
https://puppet.com/docs/puppet/5.3/indirection.html#yaml-terminus-1

Warning: That is not easy to use.

For puppet lookup we wanted something simpler and choose to expose the
option directly as it is a common use case to experiment with lookup CLI
and different facts.

Suggest you file a ticket with a feature request for puppet apply.

Best,
- henrik
Post by Abhijeet Rastogi
Puppet version: 6.0.4
Thanks,
Abhijeet
--
You received this message because you are subscribed to the Google
Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/c9c7ea63-cd97-4dbc-9c45-ee78e5cb9d4b%40googlegroups.com
<https://groups.google.com/d/msgid/puppet-users/c9c7ea63-cd97-4dbc-9c45-ee78e5cb9d4b%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/pthght%24egq%241%40blaine.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Eric Sorenson
2018-11-27 13:15:10 UTC
Permalink
You could put that same yaml or json in /etc/puppetlabs/facter/facts.d and
the whole data structure will be available under $facts ...

--eric0
Post by Henrik Lindberg
Post by Abhijeet Rastogi
Hi everyone,
puppet lookup command has a nice --facts option which accepts a
structured json/yaml file to upload files.
Why does that option not exist for puppet apply? Is the environment
variable the only option?
There is a way to make it read other facts than the default getting the
facts for the node apply is running on. To use that you need to change
the facts terminus setting
https://puppet.com/docs/puppet/5.3/indirection.html#yaml-terminus-1
Warning: That is not easy to use.
For puppet lookup we wanted something simpler and choose to expose the
option directly as it is a common use case to experiment with lookup CLI
and different facts.
Suggest you file a ticket with a feature request for puppet apply.
Best,
- henrik
Post by Abhijeet Rastogi
Puppet version: 6.0.4
Thanks,
Abhijeet
--
You received this message because you are subscribed to the Google
Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/c9c7ea63-cd97-4dbc-9c45-ee78e5cb9d4b%40googlegroups.com
Post by Abhijeet Rastogi
<
https://groups.google.com/d/msgid/puppet-users/c9c7ea63-cd97-4dbc-9c45-ee78e5cb9d4b%40googlegroups.com?utm_medium=email&utm_source=footer>.
Post by Abhijeet Rastogi
For more options, visit https://groups.google.com/d/optout.
--
Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/bf91272c-4872-455f-871b-bf1a23edfe83%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
jcbollinger
2018-11-27 14:16:07 UTC
Permalink
Post by Abhijeet Rastogi
puppet lookup command has a nice --facts option which accepts a
structured json/yaml file to upload files.
Why does that option not exist for puppet apply? Is the environment
variable the only option?
puppet apply presumes that you want to use the facts for the local node,
since that's the node to which the generated catalog will be applied. It
therefore uses the same mechanism to determine the appropriate facts as the
agent does, which, by default, is by running facter.

puppet lookup has a different orientation. It is an alternative to a
*server*-side mechanism, rather than a client-side one. Therefore, it does
not assume that you want to use the facts for the current node. The --facts
option provides a convenient mechanism for communicating multiple facts and
structured facts to it, since it cannot rely on being fed the facts
internally by the catalog builder.

Other responses have already pointed out that puppet apply does afford you
other alternatives, which you can access by manipulating the facts_terminus
setting. You should be able to do that either in the config file or on the
command line. In particular, there is a "yaml" facts terminus, though it's
unclear to me how it chooses the file from which to read facts.


John
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/a3c1406e-9266-4ea8-8ed9-da82969e1884%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...