Ask Your Question

i want to use api with puppet template to extract a needed variable ,any advise?

asked 2017-05-06 12:59:44 -0600

hamounii gravatar image

updated 2017-05-06 18:37:19 -0600

smarlow gravatar image


ICINGA2_NODENAME=<%= @fqdn %>
ICINGA2_CA_TICKET= i need to use an api to get this variable
edit retag flag offensive close merge delete



You can do this via a Custom Fact:

Red Cricket gravatar imageRed Cricket ( 2017-05-07 12:00:57 -0600 )edit

i didn't find something helpul ,i am new to puppet

hamounii gravatar imagehamounii ( 2017-05-07 20:19:47 -0600 )edit

a custom fact allows you to write a ruby method to get some information and return that to puppet, which you can use in your puppet code (or in the above case, pass that value to your template)

DarylW gravatar imageDarylW ( 2017-05-07 22:30:49 -0600 )edit

Puppet uses "facts" supplied by "facter". For example @fqdn is a built in fact. If you need need a fact that facter isn't supplying you need to write a custom fact so that facter can supply it.

Red Cricket gravatar imageRed Cricket ( 2017-05-08 00:18:51 -0600 )edit

thanks everyone for your help :)

hamounii gravatar imagehamounii ( 2017-05-08 06:02:23 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-05-07 15:48:49 -0600

jeski gravatar image

@Red Cricket has it right. custom facts is what you need.

BTW @Red Cricket question for you. Did you ever get your python API script to work with multiple classes and multiple nodes?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-05-06 12:59:44 -0600

Seen: 46 times

Last updated: May 06 '17