Add all defined baremetal hosts to the test group

The ansible add_host module only triggers once per play and as
such we need to loop over the hosts in our baremetal group, and
explicitly add each host.

Change-Id: I603586fe0d46bdf0e61ee00c14f74811a2c02ba8
This commit is contained in:
Julia Kreger 2016-03-20 14:42:08 -04:00
parent 2bbe254017
commit 11cbbc46fe

View File

@ -20,7 +20,10 @@
# keys, which can become visible as a race, hence the four second pause.
pause: seconds={{ node_ssh_pause }}
- name: "Add testvm(s) to Ansible Inventory"
add_host: name="{{ ipv4_address }}:22" groups=test
# NOTE(TheJulia): add_host only triggers once per play. Since we need to
# add all hosts, we need to use a loop.
add_host: name="{{ hostvars[item]['ipv4_address'] }}:22" groups=test
with_items: "{{ groups['baremetal'] }}"
when: ipv4_address is defined
- name: "Remove testvm hosts from SSH known_hosts file."
command: ssh-keygen -R "{{ ipv4_address }}"