You shouldn't need a plugin for this. Use a script which downloads and
prints the inventory to stdout as your inventory file.

For example:
ansible-playbook -i script.sh

On Feb 13, 2018 3:33 PM, "Archit Baweja" <arc...@waltznetworks.com> wrote:

Hey all,

In my workflow at work, we us Ansible for managing dynamically provisioned
Azure VMs after they're provisioned. Currently our provisioning scripts
setup the Azure VMs, and then generate an ansible inventory file, which we
store in AWS S3. This way, any of the operations folks who want to run post
provisioning playbooks, they go download the inventory file from AWS S3,
and then run the playbooks using the regular syntax `ansible-playbook
a-playbook.yml -i path/to/downloaded/inventory/file`.

We recently upgraded to Ansible 2.4, and was wondering, that given the new
inventory plugin refactor, if it would be possible for me to write a
plugin, that wraps the INI plugin, but does the automatic download of the
inventory from the AWS S3 source. How would I go about doing it?
Specifically...

1. Can I write my custom inventory plugin in my `lib/` directory, and
Ansible will pick it up? Or is there another path where it looks for
inventory plugins.
2. Is there any documentation on writing a custom plugin, including the
interface of expected method calls and return values?
3. Bonus, does the current design allow me to "compose" (in the sense of
functional programming) plugins over existing plugins?

So for example in my case, I would just add a wrapper plugin class (or
maybe a child class of the INI plugin), and add the logic to download the
inventory file. Specifically something that would work with the command
line `ansible-playbook my-playbook.yml -i s3://my-bucket/inventory/path`.

Thanks in advance,
Archit

P.S. Note the basic idea I'm going for is not really an Inventory plugin,as
much as writing an inventory lookup plugin.

-- 
You received this message because you are subscribed to the Google Groups
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to ansible-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to