ansible,

Ansible wait for methods

Follow · 1 min read
Share this

Ansible sample methods to wait for a machine to boot or a port to be ready.

    - name: Waits for SSH, don't start checking for 5 seconds
      wait_for:
        host: ""
        port: 22
        delay: 10
        timeout: 300
        state: started

    - name: Wait for VMs to boot up (300, 5)
      wait_for_connection:
        delay: 5
        timeout: 300
        sleep: 5

    - name: check SSH access
      local_action: shell ansible -u  -m ping 
      register: result
      until: result.rc == 0
      retries: 30
      delay: 10

    - name: Wait for VMs to boot with SSH
      local_action:
        module: wait_for host= port=22 delay=10 connect_timeout=5 timeout=300

Latest Stories

How to Pass CKA & CKAD Exams ? 10 Tips for Kubernetes Exams

Here see the best tips for Kubernetes Exams - Certified Kubernetes Administrator (CKA) & Certified Kubernetes Application Developer (CKAD).

In kubernetes, Jul 08, 2020
CKA & CKAD - Kubernetes Exam Tips, Learning Path and Certification

Since kubernetes is getting wide acceptance, Kubernetes Certification is the most trending one in IT circle now. I have completed both recently (March – April 2020) and I started gett...

In kubernetes, May 03, 2020
Start Your OpenShift Journey with these Free Red Hat Training Programs

Red Hat OpenShift Container Platform is one of the best kubernetes platform for enterprises. As we know kubernetes and OpenShift are multi-component stack and not easy to learn withou...

In openshift, Mar 09, 2020
Installing oVirt 4 with Self-Hosted Engine on Enterprise Linux

oVirt is one of the best free and open-source virtualization solution with enterprise level features. Installing oVirt cluster is simple and straight forward and you can refer the ins...

In oVirt, Mar 05, 2020

Featured