This repository contains an Ansible playbook to create machines in Digital Ocean and add entries for each to DNS using the DNSimple API.
This project has a few python dependencies.
pip install -r requirements.txt
Note that this assumes you have a DigitalOcean and DNSimple account and
have the relevant values stored in the following environment variable:
DO_CLIENT_ID
, DO_API_KEY
, DNSIMPLE_EMAIL
and DNSIMPLE_API_TOKEN
.
ansible-playbook -i hosts provision.yml
The specific code here has a few hardcoded elements that you'll likely want to change for your own usage.
A small script is provided to generate random names for use in provisioning machines. The names are used as both the name of the instance and as the subdomain so need a good degree of uniqueness.
go run printnames.go <number>
This will print a YAML formatted configuration file for use by ansible. You'll probably run something like:
go run printnames.go 200 > vars/droplets.yml