Skip to content

Instantly share code, notes, and snippets.

@shrikeh
Created December 16, 2013 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shrikeh/7985413 to your computer and use it in GitHub Desktop.
Save shrikeh/7985413 to your computer and use it in GitHub Desktop.
- name: Setup a new instance
hosts: webservers
connection: local
user: root
gather_facts: false
tasks:
- name: Ensure the ssh key for root is setup
digital_ocean: >
state=present
command=ssh
name=case
- name:
digital_ocean: >
state=present
ssh_key_ids=57705
name={{ inventory_hostname }}
size_id=66
region_id=4
image_id=1505699
private_networking=yes
virtio=yes
wait=yes
unique_name=yes
wait_timeout=500
register: droplets
- name: Add to inventory
local_action:
add_host hostname={{item.droplet.ip_address}} groupname=launched
with_items: droplets.results
- name: configure new instance
hosts: launched
gather_facts: true
user: root
tasks:
apt: upgrade=dist update_cache=yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment