Skip to content

Instantly share code, notes, and snippets.

@kelvinn
Last active August 29, 2015 14:03
Show Gist options
  • Save kelvinn/8e11e1a203ecfeb47574 to your computer and use it in GitHub Desktop.
Save kelvinn/8e11e1a203ecfeb47574 to your computer and use it in GitHub Desktop.
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