My Do-Until loop errors out if the until condition checks against a value 
that happens to contain a string like "{{ var }}". I stepped through the 
Ansible code and it attempts to evaluate "var" then throws an undefined 
variable exception. I have no control over what echo_result.stdout 
contains. How can I ask jinja2 to skip nested variable substitution and 
leave "{{ var }}" as is while evaluating the until condition?

I have simplified the scenario down to the following playbook below. Thanks 
in advance.

#Ansible version:
#  Branch: devel
#  Commit: 2015-10-28 bdf5f70 James Cammarata      Merge pull request 
#12950 from chrismeyersfsu/fix-ansible_test_service_checksum

- hosts: localhost
  gather_facts: no
  sudo: yes
  tasks:
    - name: Set facts
      set_fact:
        lb: '{'
        v: 'x'
        rbs: '}}'

    # works
    - name: Echo a variable
      command: echo "abc {{ v }}"
      register: echo_result
      until: "echo_result.stdout.find('abc') != -1"
    - debug: var=echo_result

    # breaks
    - name: Echo a nested jinja2 variable
      command: echo "abc {{ lb }}{{ lb }} {{ v }} {{ rbs }}"
      register: echo_result
      until: "echo_result.stdout.find('abc') != -1"
    - debug: var=echo_result



-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fc186fa0-a025-4a60-a6b2-3a821b487aef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to