Last active
September 22, 2016 22:09
-
-
Save bradymholt/5c6609241ada4cd77f0915c5328a260f to your computer and use it in GitHub Desktop.
Create Digital Ocean Droplet with Ansible
This file contains hidden or 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: Digital Ocean | |
hosts: all | |
connection: local | |
gather_facts: false | |
vars: | |
do_token: abc123 | |
droplets: | |
- vippers-one | |
- vippers-two | |
- vippers-three | |
tasks: | |
- name: Add ssh key | |
digital_ocean: | |
command: ssh | |
state: present | |
name: bholt | |
ssh_pub_key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" | |
api_token: "{{ do_token }}" | |
register: my_ssh_key | |
- name: Create droplet(s) | |
digital_ocean: | |
command: droplet | |
state: present | |
name: "{{ item }}" | |
unique_name: yes | |
image_id: ubuntu-16-04-x64 | |
size_id: 512mb | |
region_id: nyc3 | |
ssh_key_ids: "{{ my_ssh_key.ssh_key.id }}" | |
api_token: "{{ do_token }}" | |
with_items: droplets | |
register: droplet_details |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment