do-ansible-inventory is a tool that generates an Ansible inventory file with your DigitalOcean Droplets. It is an alternative to dynamic inventories as you can run do-ansible-inventory once and receive a static inventory file that you can use anywhere, copy, or modify.
To use do-ansible-inventory, run:
By default, without setting any options, do-ansible-inventory will attempt to look up the currently configured doctl access token and generate an ansible inventory with:
- All of your Droplets as Ansible hosts
- Each DigitalOcean region as an Ansible group containing any Droplets in that region
- Each Droplet tag as a group containing any Droplets with that tag
If you do not have
doctl installed or would like to explicitly specify the access token, run
do-ansible-inventory --access-token ACCESS_TOKEN or use the
DIGITALOCEAN_ACCESS_TOKEN environment variable.
The resulting inventory will be printed to the console. You can save it to a file instead by passing
--out inventory or redirecting the output like so:
do-ansible-inventory > inventory.
Installation and Other Instructions
Please see the project’s GitHub page for detailed instructions on how to install and use it.