Fix wait_for examples (#84870) (#84875)

connection: local is wrong as configured remote python does not always match controller
missing the timeout to wait 300s before error

(cherry picked from commit 3690819ee8)
pull/84957/head
Brian Coca 8 months ago committed by GitHub
parent bd6594e321
commit 8c03e3a74a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -187,17 +187,19 @@ EXAMPLES = r'''
host: '{{ (ansible_ssh_host|default(ansible_host))|default(inventory_hostname) }}' host: '{{ (ansible_ssh_host|default(ansible_host))|default(inventory_hostname) }}'
search_regex: OpenSSH search_regex: OpenSSH
delay: 10 delay: 10
connection: local timeout: 300
delegate_to: localhost
# Same as above but you normally have ansible_connection set in inventory, which overrides 'connection' # Same as above but using config lookup for the target,
# most plugins use 'remote_addr', but ssh uses 'host'
- name: Wait 300 seconds for port 22 to become open and contain "OpenSSH" - name: Wait 300 seconds for port 22 to become open and contain "OpenSSH"
ansible.builtin.wait_for: ansible.builtin.wait_for:
port: 22 port: 22
host: '{{ (ansible_ssh_host|default(ansible_host))|default(inventory_hostname) }}' host: "{{ lookup('config', 'host', plugin_name='ssh', plugin_type='connection') }}"
search_regex: OpenSSH search_regex: OpenSSH
delay: 10 delay: 10
vars: timeout: 300
ansible_connection: local delegate_to: localhost
''' '''
RETURN = r''' RETURN = r'''

Loading…
Cancel
Save