---
- hosts: localhost
vars:
input_file: rel.yml
var: "{{ lookup('file', '{{ input_file }}') }}"
tasks:
- name: Parse and extract the input yaml
debug:
msg: "{{ var | ('^{0}'.format(file_name)) }}"
Actual o/p:
TASK [Parse and extract the input yaml] ********************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "template error while templating string: expected token 'name', got '('. String: {{ var | ('^{0}'.format(file_name)) }}"}
expected o/p:
file_name: some1.tar
file_name: some2.gz