Last active
August 29, 2015 14:03
-
-
Save kelvinn/8e11e1a203ecfeb47574 to your computer and use it in GitHub Desktop.
Creating Digital Ocean Droplets with unique names using Ansible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- 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