title: How to specify multiple conditions in a do-until loop in Ansible
body: <p>I am making a REST call and want to check my request to be completed before going on. In the response, I either got a "PENDING" or "IN_PROGRESS" as request_status. I want to wait until I get either a "COMPLETED" or "FAILED". For this purpose, I want to wait while getting a "PENDING" or "IN_PROGRESS"</p>
  
  <p>I tried lots of variations but could not succeeded and the last try was as below:</p>
  
  <pre><code>  - name: Wait for the cluster deployment (this will take a while)
      uri:
        url: http://localhost:8080/api/v1/clusters/{{ cluster_name }}/requests/1
        method: GET
        user: admin
        password: admin
        HEADER_X-Requested-By: Ansible
        force_basic_auth: yes
        status_code: 200, 201, 202
        return_content: yes
      register: response
      until: "'{{ (response.content | from_json).Requests.request_status }}' != 'PENDING' AND '{{ (response.content | from_json).Requests.request_status }}' != 'IN_PROGRESS'"
      retries: 3
      delay: 5
  </code></pre>
  
  <p>And the error is:</p>
  
  <blockquote>
    <p>"The conditional check ''{{ (response.content
    | from_json).Requests.request_status }}' != 'PENDING' AND '{{
    (response.content | from_json).Requests.request_status }}' !=
    'IN_PROGRESS'' failed. The error was: template error while templating
    string: expected token 'end of statement block', got 'AND'. String: {%
    if 'COMPLETED' != 'PENDING' AND 'COMPLETED' != 'IN_PROGRESS' %} True
    {% else %} False {% endif %}"</p>
  </blockquote>
  
  <p>So, my question is how can I specify multiple conditions in a do-until loop in Ansible?</p>