Ask Your Question

Configuring external device with REST-Api

asked 2017-08-21 01:24:36 -0600

uherbst gravatar image

Hi all,

We have devices, where we can't run puppet agents on. The services on these devices can be configured via REST Api.

I'm currently writing a custom type/resource provider for doing this.

There are so many properties for configuring,, so I want to use self.prefetch to do this. BUT: I need some access data (let's say: device-ip-adress and port) for getting access to that device - but this data is not available in a provider method like self.prefetch (because this data is available for a provider instance from the puppet-resource-definition)

Any ideas how to solve that ?

Ideas so far:

  1. hard coding. No, I dont want to do this.
  2. Mapping certname (= puppet agent name) to device name. No, I don't want to do this
  3. Usage of some environment variables. No, I don't want to do this.
  4. external config file on my puppet agent. eg the nexus_rest module does it this way. Possibe - but I do not really like it.


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-08-21 11:20:38 -0600

DarylW gravatar image

Take a look at some of the puppet modules for managing an external resource with a rest API, like the kubernettes module. This is a dynamically generated set of custom resources which uses the swagger definition of the kubernettes APIs. You can see how the custom resource are written to interact with a rest endpoint, and duplicate that same kind of interaction for use with your REST api. There are a few other modules that do something similar, like the nexus_rest module.

You would still need to run your manifests using these resource on some node somewhere, and in most cases people either have a 'do nothing' node that stages everything (for use with modules like the above, or the, or you could just run that on a known/existing instance, like your puppet master

I hope that helps.

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-08-21 01:24:36 -0600

Seen: 143 times

Last updated: Aug 21 '17