diff options
author | Thomas Wiest <twiest@users.noreply.github.com> | 2015-05-22 11:10:55 -0400 |
---|---|---|
committer | Thomas Wiest <twiest@users.noreply.github.com> | 2015-05-22 11:10:55 -0400 |
commit | bee09c914d8acbf0f5ad5e56f068c2362d84084e (patch) | |
tree | 5f2f189c11c3ba1600cb14868fc40ba203d4b3e8 /playbooks/libvirt | |
parent | 5f784b42fb779d8feca2f4c4906966d159278811 (diff) | |
parent | 5c1c05b486b618fa0e44b758b9a6a7269a8b0ac3 (diff) | |
download | openshift-bee09c914d8acbf0f5ad5e56f068c2362d84084e.tar.gz openshift-bee09c914d8acbf0f5ad5e56f068c2362d84084e.tar.bz2 openshift-bee09c914d8acbf0f5ad5e56f068c2362d84084e.tar.xz openshift-bee09c914d8acbf0f5ad5e56f068c2362d84084e.zip |
Merge pull request #234 from lhuard1A/remove_use_of_local_arp_cache
[libvirt cluster] Use net-dhcp-leases to find VMs’ IPs
Diffstat (limited to 'playbooks/libvirt')
-rw-r--r-- | playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml b/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml index 359d0b2f3..8bf1e84ee 100644 --- a/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml +++ b/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml @@ -58,23 +58,17 @@ uri: '{{ libvirt_uri }}' with_items: instances -- name: Collect MAC addresses of the VMs - shell: 'virsh -c {{ libvirt_uri }} dumpxml {{ item }} | xmllint --xpath "string(//domain/devices/interface/mac/@address)" -' - register: scratch_mac - with_items: instances - - name: Wait for the VMs to get an IP - command: "egrep -c '{{ scratch_mac.results | oo_collect('stdout') | join('|') }}' /proc/net/arp" - ignore_errors: yes + shell: 'virsh net-dhcp-leases openshift-ansible | egrep -c ''{{ instances | join("|") }}''' register: nb_allocated_ips until: nb_allocated_ips.stdout == '{{ instances | length }}' retries: 30 delay: 1 - name: Collect IP addresses of the VMs - shell: "awk '/{{ item.stdout }}/ {print $1}' /proc/net/arp" + shell: 'virsh net-dhcp-leases openshift-ansible | awk ''$6 == "{{ item }}" {gsub(/\/.*/, "", $5); print $5}''' register: scratch_ip - with_items: scratch_mac.results + with_items: instances - set_fact: ips: "{{ scratch_ip.results | oo_collect('stdout') }}" |