You are going to need an actual file. There really isn't a way to just pass an inventory blob into ansible, that doesn't exist as a file.
I've done it with the ansible python API, but it was a bit complex, and potentially very fragile as the API was not designed for this. On Wed, Feb 15, 2017 at 7:40 AM, W Dec <[email protected]> wrote: > Hi All, > > while trying, and so far not very successfully, to work with the (overly > verbose) Ansible 2 programmatic API, I came to think of another possible > solution to my problem, but am looking for tips on how to put it into > action. > The problem: I have a python REST server which accepts host registrations. > From these I'm able to generate a JSON/YAML inventory blob, that I'd like > to pass simply to the ansible-playbook command line command spun up in a > seperate thread. I do not want to write the inventory to a local file. > > In other words, invoke ansible CLI from my python script, but poassing a > dynamically generated inventory blob. > > Playing around with all kinds of "ansible-playbook -i ... <name of > playbook>" redirects was so far unsucessful. Any pointers/examples of > something like this? > > Cheers, > W. > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/ansible-project/ab9f8682-ee55-4918-b225-0abddb2f1768%40googlegroups. > com > <https://groups.google.com/d/msgid/ansible-project/ab9f8682-ee55-4918-b225-0abddb2f1768%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Matt Martz @sivel sivel.net -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAD8N0v9uiu%3DV%3Dx_8LbEho1tdvnY2Pj%2Boud%3D9X%2BgsFUpFmj7P%3DQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
