# Ansible + AWS documentation

**URL:** <https://forum.ansible.com/t/ansible-aws-documentation/19739>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [November 11, 2015, 10:53pm UTC](https://forum.ansible.com/t/ansible-aws-documentation/19739 "2015-11-11T22:53:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![I\_like\_ansible](https://avatars.discourse-cdn.com/v4/letter/i/8c91f0/32.png) [@I\_like\_ansible](https://forum.ansible.com/u/I_like_ansible)\
**Post date:** [November 11, 2015, 10:53pm UTC](https://forum.ansible.com/t/ansible-aws-documentation/19739/1 "2015-11-11T22:53:48Z")

</div>

thanks for the documentation about how to manage AWS ec2 dynamic inventory, in this example:  
[http://docs.ansible.com/ansible/intro\_dynamic\_inventory.html#example-aws-ec2-external-inventory-script](http://docs.ansible.com/ansible/intro_dynamic_inventory.html#example-aws-ec2-external-inventory-script)

the doc is assuming that two separate accounts are used for dev vs production: hence different authentication used to connect.  
another common aws approach is to have one account but multiple VPC (prod / staging / dev) and using tags.

would love to have some info written about this second approach one account with multiple VPCs

been trying to experiment with stuff like:

hosts: “tag\_stack\_webserver: &tag\_environment\_production”

not sure if its the correct approach

---

<div class="post-metadata">

**Author:** ![wojtas](https://avatars.discourse-cdn.com/v4/letter/w/edb3f5/32.png) [@wojtas](https://forum.ansible.com/u/wojtas)\
**Post date:** [November 17, 2015, 10:17am UTC](https://forum.ansible.com/t/ansible-aws-documentation/19739/2 "2015-11-17T10:17:27Z")

</div>

Hi,  
Is there a space between “:” and “&” ?  
Is it is there delete it.  
The formula You write is ok:  
$ ansible -i /etc/ansible/ec2.py all -m ping --limit “tag\_deployment\_production:&tag\_role\_elasticsearch”  
52.XX.XXX.XXX | success \>\> {  
“changed”: false,  
“ping”: “pong”  
}

54.XX.XX.XXX | success \>\> {  
“changed”: false,  
“ping”: “pong”  
}

and in playbook:  
~ $ ansible-playbook -i /etc/ansible/ec2.py /tmp/ping.yml

PLAY [tag\_deployment\_production:&tag\_role\_elasticsearch] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

GATHERING FACTS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [54.XX.XX.XX]  
ok: [52.XX.XXX.XXX]

TASK: [TEST PING] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [54.XX.XX.XX]  
ok: [52.XX.XXX.XXX]

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
52.XX.XXX.XXX : ok=2 changed=0 unreachable=0 failed=0

~ $ cat /tmp/ping.yml

---

<div class="post-metadata">

**Author:** ![I\_like\_ansible](https://avatars.discourse-cdn.com/v4/letter/i/8c91f0/32.png) [@I\_like\_ansible](https://forum.ansible.com/u/I_like_ansible)\
**Post date:** [November 22, 2015, 3:04am UTC](https://forum.ansible.com/t/ansible-aws-documentation/19739/3 "2015-11-22T03:04:30Z")

</div>

thanks, it worked as suggested,

now I am trying create an inventory file for production and staging as suggested here in suggested here in article [Static Groups of Dynamic Groups](http://docs.ansible.com/ansible/intro_dynamic_inventory.html#static-groups-of-dynamic-groups)

production

[webservers]

“tag\_environment\_staging:&tag\_stack\_webserver”

staging

[webservers]

“tag\_environment\_production:&tag\_stack\_webserver”

but I am receiving error
