June 2018
Beginner
578 pages
13h 39m
English
We need to make one change, the droplet role, which can be found at roles/droplet/tasks/main.yml; this change takes the dynamically assigned IP address and adds it to our droplets group of hosts. To do this, replace the following task:
- name: "print the IP address of the droplet" debug: msg: "The IP of the droplet is {{ droplet_ip }}"
Replace it with the following task:
- name: add our droplet to a host group for use in the next step add_host: name: "{{ droplet_ip }}" ansible_ssh_host: "{{ droplet_ip }}" groups: "droplets"
As you can see, this takes the droplet_ip variable and adds a host using the add_host module to the group.
Read now
Unlock full access