Ansible Version: 2.0.1.0-1
I provision ec2 instances with ansible. Then I want to configure just those instances that have just been provisioned. OR - if I come back later I may want to configure (again) the same hosts and skip the provision piece. That’s clear on multiple ways to do that. What’s not clear (not possible?) is how to not repeat myself in playbooks. By way of pseudo-example:
`
If you accept the first point/reason, and are prepared to run your playbooks on all your estate that matches the real tags on the instances, then why not just use the add_host in the provisioning playbook to add the newly provisioned machines into all the “tag groups” for your consecutive plays to target.
This is the approach that I utilize with AWS and it has worked extremely well for us and has managed to scale nicely for us, although it can be slower than necessary if say you are only bringing up one more host to a group that has 10 or more other servers in it.
Thanks for the reply Peter. Yes, that is the only solution I’m able to come up with for now; Relying on the tags for the second stage of the playbook (configure). If the playbooks are idempotent then this should be okay, but still I prefer to be specific and target just what I want, when I want it.
Anyway, thanks again.