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



On Thu 9. Jul 2020 at 11:26, Rahul Kumar <rajput4u4...@gmail.com> wrote:

> 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
> ---
> name: My application configuration
>   uri:
>     url: https://{{ my_app_ip | default(ansible_fqdn)
> }}:8080/app-config/rest/vegetables
>     body_format: json
>     method: GET
>     user: "{{ my_restapi_user }}"
>     password: "{{ my_restapi_password }}"
>     force_basic_auth: true
>     follow_redirects: all
>     validate_certs: no
>
> As per above sample response , i want to continuously poll above REST API
> until i get "isFetched": true in response ! How can I do that?
>
>
> Another question i have :
>
> I have another playbook as below: (it imports above sample1.yml)
> cat master.yml
>
> ---
> - import_playbook: sample1.yml
> - import_playbook: sample2.yml
>
>
> Can I make sample2.yml import as conditional based on sample1.yml
> invocation result ? For example:
> include sample2.yml only iff isFetched= true in previous playbook response
> !
> Are variables persisted across playbooks ?
>
> Regards
> Rahul
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAGH8rEx2aHfjP-ob5RW%3DmTD0%2BAjL6u-WYn%2B4Vhe88%3DoPhNpdgw%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAGH8rEx2aHfjP-ob5RW%3DmTD0%2BAjL6u-WYn%2B4Vhe88%3DoPhNpdgw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAJ%2BRxtRRRL42-RrWkXWfk6bqreAC%2B8JV5P6qQJWKjt0RhZ%3DDkQ%40mail.gmail.com.

Reply via email to