From bf698910e72558b5479130f526b4432135fb75ad Mon Sep 17 00:00:00 2001 From: Brad Cowie Date: Sun, 15 Dec 2024 17:17:39 +1300 Subject: [PATCH] Fix prompt when there are multiple hosts in the ansible play --- handlers/main.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 729c45a..501c36b 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -10,12 +10,15 @@ - name: Prompt before changing network configuration ansible.builtin.pause: prompt: |- - Current network state: + Current network state for {{ item }}: - {{ _network_state.stdout }} + {{ hostvars[item]["_network_state"].stdout }} Please check the network configuration changes. Press enter to apply or ctrl-c to stop - when: network_wait_on_change + loop: "{{ play_hosts }}" + when: + - network_wait_on_change + - hostvars[item]["_network_state"] is defined listen: confirm network change - name: restart networking