Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Ansible 2.0 with Digital Ocean v2
$ git clone git:// --recursive
$ cd ansible
$ source ./hacking/env-setup
$ sudo pip install paramiko PyYAML Jinja2 httplib2 six
$ make
$ sudo make install
$ sudo pip install dopy
$ export DO_API_VERSION='2'
$ export DO_API_TOKEN='api_token'
- hosts: localhost
connection: local
gather_facts: false
- name: create new Droplet
state: present
command: droplet
name: ansible-test
region_id: nyc3
size_id: 512mb
image_id: ubuntu-14-04-x64
# add your ssh key signature here
- "df:69:01:08:58:0c:48:f4:88:e7:5c:e7:07:95:70:a9"
backups_enabled: no
#ipv6: yes
#user_data: null
# Need to turn off private networking to guarantee ip_address is public
#private_networking: yes
# Requried for idempotence/only one droplet creation
unique_name: yes
register: do
- name: debug
debug: var=do
- name: Add new host to our inventory.
name: "{{do.droplet.ip_address}}"
groups: do
when: do.droplet is defined
- hosts: do
remote_user: root
gather_facts: false
- name: Wait for port 22 to become available.
local_action: "wait_for port=22 host={{ inventory_hostname }}"
- name: Install tcpdump.
apt: name=tcpdump state=present
$ ansible-playbook provision.yml

This comment has been minimized.

Copy link

dminca commented Sep 30, 2016

PLAY [localhost] ***************************************************************                                                                               

TASK [create new Droplet] ******************************************************                                                                               
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NameError: name 'DoError' is not defined                      
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_cu8nmy/ansible_mo\", line 187, in <module>\n    class TimeoutError(DoError):\nNameError: name 'DoError' is not defined\n", "module_stdout": "", "msg": "MOD
ULE FAILURE"}                                                                                                                                                  

NO MORE HOSTS LEFT *************************************************************                                                                               
        to retry, use: --limit @/home/dminca/Repos/open-source/containerschiff/digiocean.retry                                                                 

PLAY RECAP *********************************************************************                                                                               
localhost                  : ok=0    changed=0    unreachable=0    failed=1                                                                                    

mine fails... added API key and SSH but not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.