Ask Your Question

Example to write a custom function

asked 2016-11-29 16:45:19 -0500

updated 2016-11-29 16:45:36 -0500

I need a custom function to do the following:

1) execute this command

export foo=$(curl -H "Token: my token" -X GET | jq -r .data.value)

2) Take the returned foo value and assign it to a variable so i can use it in puppet manifests.

3) Do steps 1 & 2 in a for loop so all the variables are set.

Can someone please provide an example to get me going.

P.S: I need this custom function to be run on the agent node not on the master.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-11-29 23:47:44 -0500

lupin gravatar image

Custom function are run in the master not in the node. Having said that, here's the docs with example.

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: 2016-11-29 16:45:19 -0500

Seen: 24 times

Last updated: Nov 29 '16