Project

General

Profile

Bug #38238 » playbook.yaml

Playbook that can be used to reproduce the issue - Martin Spiessl, 02/24/2025 02:52 PM

 
---
- name: Playbook to conditionally wait for 10 minutes if hostname contains "pattern"
hosts: all
gather_facts: yes # Ensures facts are available
strategy: free # Allows hosts to execute tasks independently
tasks:
- name: Display the hostname
ansible.builtin.debug:
msg: "The hostname is: {{ ansible_facts['hostname'] }}"

- name: Wait for 10 minutes if hostname contains "pattern"
ansible.builtin.wait_for:
timeout: 600 # Wait for 600 seconds (10 minutes)
when: "'pattern' in ansible_facts['hostname']"

- name: Dummy task to output hello world
ansible.builtin.debug:
msg: "Hello, world!"
(2-2/2)