Peeps,
Hey! I have an issue with the credstash plugin . . . if it can’t complete the lookup it simply vomits an AnsibleError, so it’s not possible to do something like:
{{ lookup(‘credstash’, ‘blah’, ‘bling’) | default(‘Sane default here’) }}
Anyone know of a way around this? So that a failed lookup can have a default?
Thanks,
Guy
I think you you need to split in two, something like this
- set_fact:
some_var: "{{ lookup('credstash', 'blah', 'bling') }}"
ignore_errors: yes
- set_fact:
some_var: Sane default here
when: some_var not defined
Another way
- debug: msg="{{ lookup('credstash', 'blah', 'bling') }}"
register: result
ignore_errors: yes
- debug: msg="Sane default here"
when: result | failed