Loop until k8s (lookup/query) module returns a valid value

Ansible Version: 2.8.1

Hi,

I’m trying to get the status of a Kubernetes StatefulSet and wait till it has a specific value.

The task looks like this:

`

  • set_fact:
    myVar: “{{ query(‘k8s’, host=‘myhost.local’, … kind=‘StatefulSet’, label_selector=‘app=test’) }}”
    retries: 5
    delay: 30
    until: “myVar[0][‘status’][‘readyReplicas’]|int == 3”

`

The problem I have is, the loop is executed but the “myVar” variable is never updated and has it’s initial value.

Has anyone seen or tried this? Is there an alternative?

Thomas