hostname variable inside of a file

Good Day!

I am very new to Ansible so I apologize. I am trying to make a playbook where I push a file to the client host with the hostname/fqdn inside the file. For example:

My file: cluster/files/etciscsi-initiatorname.iscsi

InitiatorName=iqn.1994-05.com.redhat:{|rhn.system.hostname|}

Where {|rhn.system.hostname|} is replaced with the fqdn that the file is being pushed to. I figured out how to get the ansible_fqdn from the ansible_facts but i’m struggling beyond that.

[root@walter tasks]# cat initiatorname.iscsi.yml

Are you doing this in a shell loop? Look at the -e option.

Mike

I strongly encourage you to take the Red Hat Ansible class. It is a week long class and worth every penny.

Walter

Thanks!