<p>While it may not be the answer you are looking for, puppet's DSL lacks verbs on purpose.  Puppet's idempotent philosophy is a huge reason it is so useful for some use cases but for this type of need you will want to use a tool which is more targeted to that role.</p>

<p>When you hit limitations due to the idempotent philosophy of Puppet it is a good indication that another tool is required for that need.</p>

<p>I would look for publicly maintained tools for the task maybe in Ansible or Terraform.</p>

<p>We leveraged the "puppet kick" functionality of puppet and then tried to extend it after it was deprecated and the pain of trying to ignore their design philosophy is an expensive one.</p>

CC BY-SA 3.0
2017-05-19T22:53:28.133Z
2017-05-19T22:53:28.133Z
gdahlm
<p>I have tried making REST calls with puppet and it was... well... awful. I didn't really want to use pure ruby to interact with my load balancer and my concern was that for REST calls, every time the puppet run occurs I would be idempotently slamming my web server with a ton of requests - first checking if a particular item is out of spec and then possibly resetting it. Using curl via an exec and an unless statement was arduous to say the least.</p>

<p>Furthermore, the <a href="https://puppet.com/blog/idempotence-not-just-a-big-and-scary-word" rel="nofollow noreferrer">idempotent philosophy</a> of puppet doesn't always play well with REST APIs that are <a href="https://softwareengineering.stackexchange.com/questions/260818/why-patch-method-is-not-idempotent">not idempotent</a>.</p>

<p>Are there any simple ways, ready-made methods or plugins for dealing with REST APIs via puppet?</p>

<p><strong>Note</strong>: one feature request to watch: <a href="https://tickets.puppetlabs.com/browse/PUP-6658?filter=-2" rel="nofollow noreferrer">https://tickets.puppetlabs.com/browse/PUP-6658?filter=-2</a></p>

CC BY-SA 3.0
2017-05-20T04:00:41.437Z
You do Puppet and then you rest...
Jiri Klouda
CC BY-SA 3.0
2017-05-20T20:34:36.223Z
A REST API must be idempotent by definition,  if it is not,  it's just a HTTP API (a little pedantic but let's be precise here)
Tensibai
<puppet>
What is the best way to do REST with puppet?
James Shewey
# What is the best way to do REST with puppet?

(Asked by: username_0 on 2017-05-19)

I have tried making REST calls with puppet and it was... well... awful. I didn't really want to use pure ruby to interact with my load balancer and my concern was that for REST calls, every time the puppet run occurs I would be idempotently slamming my web server with a ton of requests - first checking if a particular item is out of spec and then possibly resetting it. Using curl via an exec and an unless statement was arduous to say the least.

Furthermore, the [idempotent philosophy](https://puppet.com/blog/idempotence-not-just-a-big-and-scary-word) of puppet doesn't always play well with REST APIs that are [not idempotent](https://softwareengineering.stackexchange.com/questions/260818/why-patch-method-is-not-idempotent).

Are there any simple ways, ready-made methods or plugins for dealing with REST APIs via puppet?

**Note**: one feature request to watch: <https://tickets.puppetlabs.com/browse/PUP-6658?filter=-2>

**Tags:** puppet

> **Comments:**
> **username_1**: You do Puppet and then you rest...  
> **username_2**: A REST API must be idempotent by definition,  if it is not,  it's just a HTTP API (a little pedantic but let's be precise here)  

---

## 1 answers

### Answer by username_3 on 2017-05-19. Score: 1

While it may not be the answer you are looking for, puppet's DSL lacks verbs on purpose. Puppet's idempotent philosophy is a huge reason it is so useful for some use cases but for this type of need you will want to use a tool which is more targeted to that role.

When you hit limitations due to the idempotent philosophy of Puppet it is a good indication that another tool is required for that need.

I would look for publicly maintained tools for the task maybe in Ansible or Terraform.

We leveraged the "puppet kick" functionality of puppet and then tried to extend it after it was deprecated and the pain of trying to ignore their design philosophy is an expensive one.


---

