Hi Geeks ,
I have a task as below which returns me some data. I want to continuously poll this request until I get a specific attribute in response as true.
Here is the response from the playbook sample1.yml:
{“_id”:“89494fnfi04m0”,“price”:“$17”,“isFetched”: false}
cat sample1.yml
You can register it and use retries until it gets something you want . The. You can call you second playbook with your when condition .
You have to provide the exact output to get condition .
Until: register.somthing.isFetched == true
Thanks Vinoth ! Once i put condition like that:
until: result[‘results’][0].content.isFetched == True
It says
“msg”: “The conditional check ‘result[‘results’][0].content.isFetched == True’ failed. The error was: error while evaluating conditional (result[‘results’][0].content.isFetched == True): ‘dict object’ has no attribute ‘results’”
But in next task if i print same thing:
- name: Print Response of status resource
debug:
msg: “Boss Version: {{ result[‘results’][0].content.isFetched }}”
It gives me output:
“msg”: “Boss Version: True”
I am not sure how until works , does it wait till some condition becomes true with continuous polling ?
Regards
Rahul