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”: “”
}