Visit site

do-ansible-inventory is a tool to generate Ansible inventories of DigitalOcean Droplets

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
  • Each project as a group containing any Droplets within that project

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.

Was this helpful?
Leave a comment

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Publish your Tool on Community

Have you created an Integration, API Wrapper, Service, or other Tool that helps developers build on DigitalOcean? Help users find it by listing it in Community Tools.

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel