until loop in shell module

Im thinking…, why this does not work?

Task:

  • name: Run validation query on db localy
    shell: docker exec -i postgres bash -c ‘psql -v --username “postgres” --dbname “postgres” -c “select 1”’
    delegate_to: “{{ item }}”
    with_items: “{{ groups.postgres_server}}”
    register: validation
    until: validation.results[0].stderr == “”
    retries: 10
    delay: 30
    ignore_errors: false
    become: true
    become_user: root
    become_method: sudo

Result:
fatal: [localhost]: FAILED! => {“failed”: true, “msg”: “The conditional check ‘validation.results[0].stderr == ""’ failed. The error was: error while evaluating conditional (validation.results[0].stderr == ""): ‘dict object’ has no attribute ‘results’”}

Task:

  • debug:
    msg: “{{ validation.results[0].stdout }}”

Result:
ok: [localhost] => {
“msg”: “”
}

I guess that i have compare it like…

  • debug:
    msg: “{{ hostvars[inventory_hostname][validation.results[0].stderr] }}”

But still not working…

Dne čtvrtek 11. května 2017 11:38:32 UTC+2 mhh napsal(a):

This is working…

  • debug:
    msg: “{{ hostvars[inventory_hostname].validation.results[0].stderr }}”

Dne čtvrtek 11. května 2017 12:08:05 UTC+2 mhh napsal(a):

But how to implement in until condition ?

Dne čtvrtek 11. května 2017 12:11:26 UTC+2 mhh napsal(a):