Ask Your Question
0

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

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

hamounii gravatar image

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

smarlow gravatar image

Template:

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

Comments

1

You can do this via a Custom Fact: https://docs.puppet.com/facter/3.6/custom_facts.html

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

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

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

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 -0500 )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 -0500 )edit

thanks everyone for your help :)

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

1 Answer

Sort by ยป oldest newest most voted
0

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

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

Stats

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

Seen: 31 times

Last updated: May 06