From d8472c64a2e36f7a5ac31e4db51bcbcfa791c6e8 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Sat, 29 Jun 2024 07:57:59 -0500 Subject: [PATCH] wait-for-host: PB to wait for a host to come up This playbook just waits for a machine to become available. It's useful when running Ansible immediately after creating a new machine. --- wait-for-host.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 wait-for-host.yml diff --git a/wait-for-host.yml b/wait-for-host.yml new file mode 100644 index 0000000..ae0ce73 --- /dev/null +++ b/wait-for-host.yml @@ -0,0 +1,10 @@ +- hosts: all + gather_facts: false + tasks: + - name: wait for host to come up + become: false + delegate_to: localhost + connection: local + wait_for: + host: '{{ ansible_host | d(inventory_hostname) }}' + port: '{{ ansible_port | d(22) }}'