Re: [ansible-project] Loading variables with data from REST

2019-09-24 Thread Mark Anthony Garcia
I've used this using uri module, fust to get the cookies and use the cookie
to run several api queries. I used jinja to template the data for API PUT
and POST but it's a bit tricky with the formating.

I'm not in front of my pc but perhaps first thing tomorrow I'll share what
I have.

Mark Garcia

On Tue, Sep 24, 2019, 8:25 PM Paul Hoffman 
wrote:

> I'd like to leverage systems with an API to provide variables to playbooks
> running on the controller.
> Something similar to a dynamic inventory script loading from an external
> system.
>
> For example with a curl command and can get the exact contents I need.
> IE: {"myVariable":"myValue"}  or yaml format:
> myVariable: myValue
>
> I've looked at the uri module and it looks promising.  The values returned
> by the GET call are embedded in the
> returned contents along with many other API variables.
>
> The idea being when I need a value that changes frequently or shouldn't be
> included in static playbooks I call the
> external system that has the master value and load it.
> I'd prefer not pulling the data into a variable file first.  That would
> avoid file management issues.
>
> I'm not too familiar with jinja2 but perhaps there's a way to take the
> output from URI and parse out the values.
> I'm sure there is a way to do this that I haven't come across yet.
>
> If anyone has already solved this point me in the right direction.
> v/r
>
> --
> 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-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/cd69ac14-8216-441d-a413-6f4e42804892%40googlegroups.com
> 
> .
>

-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAGFwMxqC-Ffd3fPEHJYCykRgVW7d5iK3LOhKNOcDZBLCu6O8Aw%40mail.gmail.com.


[ansible-project] Loading variables with data from REST

2019-09-24 Thread Paul Hoffman
I'd like to leverage systems with an API to provide variables to playbooks 
running on the controller.
Something similar to a dynamic inventory script loading from an external 
system.

For example with a curl command and can get the exact contents I need.  IE: 
{"myVariable":"myValue"}  or yaml format:
myVariable: myValue

I've looked at the uri module and it looks promising.  The values returned 
by the GET call are embedded in the 
returned contents along with many other API variables.

The idea being when I need a value that changes frequently or shouldn't be 
included in static playbooks I call the 
external system that has the master value and load it.
I'd prefer not pulling the data into a variable file first.  That would 
avoid file management issues.

I'm not too familiar with jinja2 but perhaps there's a way to take the 
output from URI and parse out the values.
I'm sure there is a way to do this that I haven't come across yet.

If anyone has already solved this point me in the right direction.
v/r

-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/cd69ac14-8216-441d-a413-6f4e42804892%40googlegroups.com.