I load a file with the content Some {{bar}} random text using the file lookup plugin:
- name: Load foo
set_fact:
foo: "{{ lookup('file', 'foo.txt') }}"
- name: Output foo
debug:
msg: "{{foo}}"
If I output {{foo}}, the output is literally Some {{bar}} random text. Ignoring the fact that I could use the template lookup plugin instead: Is it possible to evaluate {{foo}} after the file has been loaded, so that the actual value of bar will be injected into Some {{bar}} random text?
I am looking for something like:
- name: Evaluate foo
set_fact:
evaulated_foo: "{{ lookup('template', foo) }}" #Use the value of foo instead of a file