'Wait for instance to respond to ansible ping.'

def wait(self):

    extra_vars = ['ansible_connection=winrm', ('ansible_host=%s' % self.core_ci.connection.hostname), ('ansible_user=%s' % self.core_ci.connection.username), ('ansible_password=%s' % self.core_ci.connection.password), ('ansible_port=%s' % self.core_ci.connection.port), 'ansible_winrm_server_cert_validation=ignore']
    name = ('windows_%s' % self.core_ci.version)
    env = ansible_environment(self.core_ci.args)
    cmd = ['ansible', '-m', 'win_ping', '-i', ('%s,' % name), name, '-e', '    '.join(extra_vars)]
    for _ in range(1, 120):
        try:
            run_command(self.core_ci.args, cmd, env=env)
            return
        except SubprocessError:
            sleep(10)
            continue
    raise ApplicationError(('Timeout    waiting    for    %s/%s    instance    %s.' % (self.core_ci.platform, self.core_ci.version, self.core_ci.instance_id)))
