Skip to content

Instantly share code, notes, and snippets.

@kelvinn

kelvinn/new-do-db.yml

Last active Aug 29, 2015
Embed
What would you like to do?
Creating Digital Ocean Droplets with unique names using Ansible
---
- name: Prepare New Digital Ocean Droplet
hosts: you.example.com
user: ansible
tasks:
- action: shell date +%s | sha256sum | base64 | head -c 6
register: rand_var
- digital_ocean: >
state=present
command=droplet
name=db-{{ rand_var.stdout }}
unique_name=yes
client_id=12345ABCDEF
api_key=54321XYZ
ssh_key_ids=SSHKEYID_NUM_EG_12345
private_networking=yes
size_id=66
region_id=6
image_id=3240036
wait_timeout=500
register: my_droplet
- debug: msg="ID is {{ my_droplet.droplet.id }}"
- debug: msg="IP is {{ my_droplet.droplet.ip_address }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment