- hosts: digitalocean
vars:
- zonomi_api_key: <my zonomi api key>
- zonomi_url: http://zonomi.com/app/dns/dyndns.jsp
- do_url: <URL of do_droplet>
- do_domain: <my domain>
tasks:
- name: Add droplet
digital_ocean: >
state=present
command=droplet
name={{ item.key }}
size_id=512mb
region_id=ams2
image_id={{ item.value.image_id }}
ssh_key_ids={{ my_ssh_key.ssh_key.id }}
unique_name=yes
with_dict: "{{ droplets_up }}"
register: my_droplet
- debug:
msg: {{ my_droplet.droplet.ip_address }
fatal: [localhost]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'dict object' has no attribute 'id'\n\nThe error appears to have been in '/my/path/digitalocean.yml': line 33, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n msg: Droplet details are {{ my_droplet }}\n - debug:\n ^ here\n"}- debug:
msg: "{{ my_droplet.droplet.ip_address }}"- debug: msg={{ my_droplet.droplet.ip_address }}