I'm using Ansible (V2.8) to build two different server environments that happen to support Drupal. They are very similar in terms of the settings for the OS, RDBMS, gluster, memcached, etc. But very different with regards to the use of Drupal (different versions, different number of drupal instances, etc.). Consequently while almost all of the playbooks, var files etc. are common, I have platform-specific playbooks for Drupal.
I have separate inventory files, but a common site.yml file that just contains a bunch of import_playbook: statements.
What I'm struggling with is the best way to choose the correct drupal playbook.
At the moment I'm using the following on the command line:
-i /vagrant/inventories/inventory-env1.ini --extra-vars environment_name=env1
Which allows the following statement to work in site.yml
- import_playbook: playbooks/drupal/drupal_{{environment_name}}.yml
But that means I'm specifying the environment twice on the same command line, once to choose the inventory file and once to set a variable. As I normally find tautology is evidence of poor programming, it makes me think I'm missing a better way of doing this.
Ideally I'd like to simply specify 'environment_name' in the inventory file. But I can't because it is not available to site.yml for reasons described here: https://github.com/ansible/ansible/issues/33659.
So, am I missing something, or is this just how it is?