# ec2 provision/configure same playbook & tags

**URL:** <https://forum.ansible.com/t/ec2-provision-configure-same-playbook-tags/21038>\
**Category:** Ansible Project\
**Created:** [March 31, 2016, 9:43pm UTC](https://forum.ansible.com/t/ec2-provision-configure-same-playbook-tags/21038 "2016-03-31T21:43:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scott\_Armit](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@Scott\_Armit](https://forum.ansible.com/u/Scott_Armit)\
**Post date:** [March 31, 2016, 9:43pm UTC](https://forum.ansible.com/t/ec2-provision-configure-same-playbook-tags/21038/1 "2016-03-31T21:43:24Z")

</div>

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:

`

---

<div class="post-metadata">

**Author:** ![Peter\_Murray1](https://avatars.discourse-cdn.com/v4/letter/p/41988e/32.png) [@Peter\_Murray1](https://forum.ansible.com/u/Peter_Murray1)\
**Post date:** [April 2, 2016, 10:37am UTC](https://forum.ansible.com/t/ec2-provision-configure-same-playbook-tags/21038/2 "2016-04-02T10:37:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Scott\_Armit](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@Scott\_Armit](https://forum.ansible.com/u/Scott_Armit)\
**Post date:** [April 4, 2016, 4:25pm UTC](https://forum.ansible.com/t/ec2-provision-configure-same-playbook-tags/21038/3 "2016-04-04T16:25:03Z")

</div>

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.
