salt.states.loop module

Loop state

Allows for looping over execution modules.

New in version 2017.7.0.

wait_for_service_to_be_healthy:
  loop.until:
    - name: boto_elb.get_instance_health
    - condition: m_ret[0]['state'] == 'InService'
    - period: 5
    - timeout: 20
    - m_args:
      - {{ elb }}
    - m_kwargs:
        keyid: {{ access_key }}
        key: {{ secret_key }}
        instances: "{{ instance }}"

Warning

This state allows arbitrary python code to be executed through the condition parameter which is literally evaluated within the state. Please use caution.

salt.states.loop.until(name, m_args=None, m_kwargs=None, condition=None, period=0, timeout=604800)

Loop over an execution module until a condition is met.

name

The name of the execution module

m_args

The execution module's positional arguments

m_kwargs

The execution module's keyword arguments

condition

The condition which must be met for the loop to break. This should contain m_ret which is the return from the execution module.

period

The number of seconds to wait between executions

timeout

The timeout in seconds