Related to vars_files

Hi all,

I’m stuck using vars_file correctly. I have the following playbook (livetrack.yml) that it processes roles “lt” and “network”. The LT role copies a vhost.conf file to the httpd conf.d directory with a variable defining the interface which the vhost will listen. And the network role copies network definition for hosts in the inventory.

hosts hostnames: LT1, LT2

What is happening is that the vars are loaded only for the network role. If I run only the playbook with the “lt role” the {{ ip_address_o }} variable is never loaded, in comparison if I run only the playbook with the “network role” that it runs smoothly.

cat livetrack.yml

You need to make the vhost.conf file a template, and not a file. Right now it’s bypassing the templating completely and you’re just copying it out as-is.

Good point, thanks for that.