Ansible pattern for API-based config management

132 views
Skip to first unread message

Salman Haq

unread,
Apr 9, 2014, 2:11:33 PM4/9/14
to ansible...@googlegroups.com
I am exploring automation of a Hadoop cluster.

The vendor (Cloudera) requires that all configuration happen through a REST API. See [1] for Cloudera Python API client.

My question is: Is there a prior example of an Ansible playbook that wraps an HTTP api?

Thanks!
Salman

Paul Durivage

unread,
Apr 10, 2014, 12:14:24 PM4/10/14
to ansible...@googlegroups.com
The type of work you're looking to do is best handled by writing a Cloudera module.  I don't want to imagine how one might wrap a REST API in a playbook -- that does not sound fun or reasonable.  :)

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7f429a09-d199-4cea-b38d-aba5416c1519%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Drew Northup

unread,
Apr 10, 2014, 1:37:25 PM4/10/14
to ansible...@googlegroups.com
On Thursday, April 10, 2014 12:14:24 PM UTC-4, Paul Durivage wrote:
The type of work you're looking to do is best handled by writing a Cloudera module.  I don't want to imagine how one might wrap a REST API in a playbook -- that does not sound fun or reasonable.  :)

Paul,
It has already been done...

On Wed, Apr 9, 2014 at 2:11 PM, Salman Haq <shaq...@audaxhealth.com> wrote:
I am exploring automation of a Hadoop cluster.

The vendor (Cloudera) requires that all configuration happen through a REST API. See [1] for Cloudera Python API client.

My question is: Is there a prior example of an Ansible playbook that wraps an HTTP api?

Salman,
Look at this module's doc page: http://docs.ansible.com/uri_module.html
(Romeo even provided some examples, prior to the existence of a JIRA module).

Paul Durivage

unread,
Apr 10, 2014, 2:05:39 PM4/10/14
to ansible...@googlegroups.com
Hi Drew,

You're right, the URI module is available.  I didn't mention it because Salman mention he was going to be coordinating the automation for an entire cluster.  The URI module is useful, yes, but interacting with a large API for complex tasks?  That's what I meant when I said that I don't want to know what such a playbook might look like.

So, yes, that functionality exists, but it's way less than ideal for working repeatedly with complex APIs.  This functionality really deserves to be in a module.


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Michael DeHaan

unread,
Apr 15, 2014, 5:00:53 PM4/15/14
to ansible...@googlegroups.com
Yeah it depends on what you need to do.

I would hope the vendor also exposes a CLI that talks to their REST API, so you could call to that without needing a module, but if a module makes sense and one is built, this is something we could possibly consider for core inclusion.

The uri module is quite useful for some simple things, though registering a lot of results and using a lot of conditionals quickly gets into programming territory -- which is to say a module could be used, or even the script module could be used to call a small script too.




Reply all
Reply to author
Forward
0 new messages