Re: [Puppet Users] Have Puppet *call* REST APIs

1,603 views
Skip to first unread message

Craig Dunn

unread,
Jan 4, 2013, 6:02:16 AM1/4/13
to puppet...@googlegroups.com

>
> I hope this is just not my Google-fu lacking, but can you configure
> Puppet modules to make REST API calls inherently with Puppet? I'm
> talking about 3rd party REST APIs, not Puppet's API. I'm thinking of
> rolling my own plugin, but wondered if I'm missing something here.
>
Can you provide a bit more information on what you're trying to do? If
are you are trying to look up a value from a REST API call you could use
Hiera with the http backend. Or are you trying to get Puppet to post
data to a REST API when it runs? And if so do you want this to happen
on the agent when the resource gets applied, or on the server during
catalog compilation in the form of a function? Whether or not you are
doing anything with the data returned from your call will make a
difference here.

Craig

--
Craig Dunn
Professional Services
Puppet Labs Inc.
http://www.puppetlabs.com

Rob Johnson

unread,
Jan 4, 2013, 9:22:30 AM1/4/13
to puppet...@googlegroups.com
Hi Craig,

Thanks for your reply.

I'm looking to post requests to a server that configures properties of that server after standing it up.  So, I would envision sending requests from puppet master in this case to one server.

It would happen likely after a bunch of other installations occurred first (that's standard RPM deployment).  So it's:

1) Install a bunch of software on numerous machines including server process on a specific machine. (simplified, there's more config I have to do here)
2) Start up the master server.
3) Configure the master server via REST API Posts.  I mainly need to check the replies for return status I think.  Don't need to process the requests too much.

Does that make sense?  I probably have to build some custom plugins or something to do this right?  I was thinking about "exec" calls to curl or something, but that seems a little kludgy.

Thanks for any advice, it's much appreciated!
Rob

Ohad Levy

unread,
Jan 5, 2013, 7:36:25 AM1/5/13
to Puppet Users
On Fri, Jan 4, 2013 at 4:22 PM, Rob Johnson <r...@cloudera.com> wrote:
Hi Craig,

Thanks for your reply.

I'm looking to post requests to a server that configures properties of that server after standing it up.  So, I would envision sending requests from puppet master in this case to one server.

It would happen likely after a bunch of other installations occurred first (that's standard RPM deployment).  So it's:

1) Install a bunch of software on numerous machines including server process on a specific machine. (simplified, there's more config I have to do here)
2) Start up the master server.
3) Configure the master server via REST API Posts.  I mainly need to check the replies for return status I think.  Don't need to process the requests too much.

Does that make sense?  I probably have to build some custom plugins or something to do this right?  I was thinking about "exec" calls to curl or something, but that seems a little kludgy.

Just remember once difference between exec and a puppet function, an exec happens on the client(agent) so you would need to allow access to all of your clients, a function runs on the server, however that happens during catalog run, so you dont really know what the client did, you would need to check the report from the client to know for sure.

good luck,
Ohad 
Thanks for any advice, it's much appreciated!
Rob

On Friday, January 4, 2013 5:02:16 AM UTC-6, Craig Dunn wrote:

>
> I hope this is just not my Google-fu lacking, but can you configure
> Puppet modules to make REST API calls inherently with Puppet?  I'm
> talking about 3rd party REST APIs, not Puppet's API.  I'm thinking of
> rolling my own plugin, but wondered if I'm missing something here.
>
Can you provide a bit more information on what you're trying to do? If
are you are trying to look up a value from a REST API call you could use
Hiera with the http backend.  Or are you trying to get Puppet to post
data to a REST API when it runs?  And if so do you want this to happen
on the agent when the resource gets applied, or on the server during
catalog compilation in the form of a function? Whether or not you are
doing anything with the data returned from your call will make a
difference here.

Craig

--
Craig Dunn
Professional Services
Puppet Labs Inc.
http://www.puppetlabs.com

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/XP2goJEbl-UJ.

To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Reply all
Reply to author
Forward
0 new messages