# Updating Tags in EC2 using module ec2\_tags is not working

**URL:** <https://forum.ansible.com/t/updating-tags-in-ec2-using-module-ec2-tags-is-not-working/14888>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [March 28, 2014, 10:35pm UTC](https://forum.ansible.com/t/updating-tags-in-ec2-using-module-ec2-tags-is-not-working/14888 "2014-03-28T22:35:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bob\_Brown1](https://avatars.discourse-cdn.com/v4/letter/b/dfb087/32.png) [@Bob\_Brown1](https://forum.ansible.com/u/Bob_Brown1)\
**Post date:** [March 28, 2014, 10:35pm UTC](https://forum.ansible.com/t/updating-tags-in-ec2-using-module-ec2-tags-is-not-working/14888/1 "2014-03-28T22:35:29Z")

</div>

Trying to update tags where the tags are missing on AWS ec2 instances

My Playbook looks like this:

- name: Add a Tag  
hosts: foo  
tasks:  
register: ec2  
local\_action: ec2\_tag resource={{ item.id }} region=us-east-1 state=present  
with\_items: ec2.instances  
args:  
tags:  
Test: foobar

Running the playbook gives back these results:

ansible-playbook test.tag.yml -vv  
/usr/lib64/python2.6/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz\_powm\_sec. You should rebuild using libgmp \>= 5 to a  
void timing attack vulnerability.  
\_warn(“Not using mpz\_powm\_sec. You should rebuild using libgmp \>= 5 to avoid timing attack vulnerability.”, PowmInsecureWarning)

PLAY [Add a Tag] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

GATHERING FACTS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
\<[ec2-xxxxxxxx.compute-1.amazonaws.com](http://ec2-xxxxxxxx.compute-1.amazonaws.com)\> REMOTE\_MODULE setup  
ok: [[ec2-54-225-16-163.compute-1.amazonaws.com](http://ec2-54-225-16-163.compute-1.amazonaws.com)]

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
[ec2-xxxxxx.compute-1.amazonaws.com](http://ec2-xxxxxx.compute-1.amazonaws.com) : ok=1 changed=0 unreachable=0 failed=0

I’ve tried different options but it doesn’t update the tag even thought the tag is not present.

Some instructions don’t have the “register: ec2”. I’m not sure what that does in this context. What values get populated, where does it take it from?  
Sometimes “with\_items” has either “item”, or “ec2\_instances” instead of “ec2.instances”. Which should I use? What is it referring to. Sometimes my error is that the “id not found in item”.  
Sometimes the ec2.instances shows as $(ec2.instances)

Anyway, a clarification of what choices to make, what the steps actually do and a suggestion as to why it isn’t working.

Thanks,

Bob
