I am kinda confused on what is the right syntax to try out this. Running a role multiple times in a single playbok but a different var_files each time.
I have a web server role for a LAMP stack that will also install the Apache vhost site. My idea was that I can run this role on the same server if I was installing multiple sites - Ansible would just skip the software installations but just install the vhost configs.
This works fine if I run the playbook multiple times manually. What I want to do is to do this multiple times in one single playbook. My assumption is that I should be using Role Dependencies (amirite?).
Though I guess maybe the var_files should be in the roles itself perhaps? I could try to make my role take in either individual vars or if a var_files is defined, to use that instead?
I don’t know what you’re trying to achieve exactly … but assuming that all your vhosts have the same configuration file structure, you could use a template and to something like below: