--- - hosts: localhost connection: local gather_facts: false tasks: - name: create two droplets digital_ocean_droplet: unique_name: yes region: ams3 image: ubuntu-18-10-x64 wait_timeout: 100 name: "{{ item }}" size_id: s-1vcpu-1gb state: present ssh_keys: [ '1' ] # <---- put your numeric ssh key in here register: created_droplets with_items: - tmp-droplet-1 - tmp-droplet-2 - name: add to dynamic inventory add_host: name: "{{ item.data.ip_address }}" group: do with_items: "{{ created_droplets.results }}"