Closed thecodesmith closed 7 years ago
Ooh, nice idea, I like this! Thank you for this contribution! I'm happy it's of use to you.
Probably the "best practice" would be to define separate Ansible inventory groups for your clients and servers, but my Vagrant configuration does not support this as of yet.
Maybe I'll implement it sometime in the future (see https://www.vagrantup.com/docs/provisioning/ansible_intro.html, a bit below halfway down the page), but until then, your contribution is a fine alternative.
I have a setup with many VMs, that fall into the categories of either "server" or "client". Perhaps there's a simpler way on the Ansible side to handle this, but I added an optional
playbook:
key to handle different playbook filenames.Example:
The above configuration uses
ansible/server.yml
andansible/client.yml
files for the Ansible provisioning. If theplaybook:
key is not provided, it defaults toansible/site.yml
as before.I'm fairly new to Ansible, so if there is a cleaner way to do this, just let me know. Thanks for making this public! It's helping me immensely.