wait_for_result module

Hi,

I wrote a module to loop on a command until you get an expected result.

This is useful when you don’t want your playbook to continue until for ex your Solr warmup is done and you engine is ready to take request.

Basically, it works like this :

  • name: wait for solrwarmup
    local_action : kk_wait_for_result command=‘wget -O - “http://{{ ansible_fqdn }}:{{ port }}/searchsolrnode{{ country }}/{{ country}}/select?q=:&rows=0”’ result=“numFound” delay=30 timeout=600

It is written in Python with all the requirement to be added into Ansible core.

Would you be interested in adding it?

Thanks,

Ludo

PS : Here is the code of the module

#!/usr/bin/python

-- coding: utf-8 --

import datetime
import time
import sys

DOCUMENTATION = ‘’’

That’s pretty neat, though unfortunately I want to do this a little bit differently, so I’m unlikely to merge this into core (of course, you’re welcome to continue to use this, as what I want isn’t done yet anyway!).

Here’s what I am looking to do with this, so it’s more applicable to all modules:

https://github.com/ansible/ansible/issues/2959

OK thanks for the update. I’ll indeed keep my module until the logic inside the playbook is released.