DigitalOcean Example for Ansible
Chapter 7 of Ansible for DevOps contains details and examples for using Ansible to provision and dynamically work with DigitalOcean droplets.
Dynamic Inventory and Provisioning
Examples using Ansible's DigitalOcean integration are contained within this directory.
provision.ymlcontains an example of provisioning a new DigitalOcean droplet, then immediately configuring it with Ansible.
digital_ocean.ini) is the DigitalOcean dynamic inventory script included with Ansible. Don't use this copy; get the latest version from the Ansible project: digital_ocean.py.
Before you can use either of these examples, you will need to set an environment variable with your DigitalOcean API Personal Access Token: