From c689b3f927c492a9792e57b6963ec11b59f6ce00 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Mon, 10 Feb 2020 04:19:34 +0000 Subject: [PATCH] use delegate_to to wait for eos VM to reboot In some cases, the controller cannot reach eos VM directly. We need to delegate_to to vm host name to test reachability of port 22 on VM. --- ansible/roles/eos/handlers/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ansible/roles/eos/handlers/main.yml b/ansible/roles/eos/handlers/main.yml index a99ee1aa321..505639403a4 100755 --- a/ansible/roles/eos/handlers/main.yml +++ b/ansible/roles/eos/handlers/main.yml @@ -10,20 +10,20 @@ - name: Wait for VM to shutdown wait_for: - host: "{{ ansible_ssh_host }}" + host: "{{ ansible_host }}" port: 22 state: stopped delay: 10 timeout: 300 - connection: local + delegate_to: "{{ VM_host[0] }}" listen: "Update VM state" - name: Wait for VM to startup wait_for: - host: "{{ ansible_ssh_host }}" + host: "{{ ansible_host }}" port: 22 state: started delay: 10 timeout: 1200 - connection: local + delegate_to: "{{ VM_host[0] }}" listen: "Update VM state"