# Ansible + EC2 & Quoting.

**URL:** <https://forum.ansible.com/t/ansible-ec2-quoting/17891>\
**Category:** Ansible Project\
**Created:** [April 2, 2015, 3:17pm UTC](https://forum.ansible.com/t/ansible-ec2-quoting/17891 "2015-04-02T15:17:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nico\_K](https://avatars.discourse-cdn.com/v4/letter/n/46a35a/32.png) [@Nico\_K](https://forum.ansible.com/u/Nico_K)\
**Post date:** [April 2, 2015, 3:17pm UTC](https://forum.ansible.com/t/ansible-ec2-quoting/17891/1 "2015-04-02T15:17:43Z")

</div>

Hi,

I’m trying to spawn an EC2 instance through a role.  
However, I can’t get “instance\_tags” to work when I try to pass in the value through a parameter.

group\_vars/all:

ec2\_instance\_tags: ‘{“name”:“test”}’

roles/ec2/tasks/main.yml:

- name: xx  
ec2:  
…  
…  
instance\_tags: “{{ ec2\_instance\_tags }}”  
register: x

results in: msg: No handler was ready to authenticate. 1 handlers were checked. [‘QuerySignatureV2AuthHandler’] Check your credentials (bit of a weird error message too).  
I’ve played around with quoting for a while but I can’t seem to work out how to do this…

Any pointers are welcome 🙂

Thanks,  
Nico

---

<div class="post-metadata">

**Author:** ![Ivan\_S\_Freitas](https://avatars.discourse-cdn.com/v4/letter/i/e99b99/32.png) [@Ivan\_S\_Freitas](https://forum.ansible.com/u/Ivan_S_Freitas)\
**Post date:** [April 2, 2015, 6:54pm UTC](https://forum.ansible.com/t/ansible-ec2-quoting/17891/2 "2015-04-02T18:54:15Z")

</div>

This seems an authentication error, are you sure that your AWS access  
and secret keys are visible to your task? Also, this bug [1] may be  
related to the authentication error in the ec2 tagging, can you try  
testing with a explicity ec2\_tag action to see if you can tag  
instances separatedly?

[1] [https://github.com/ansible/ansible/issues/9984](https://github.com/ansible/ansible/issues/9984)

---

<div class="post-metadata">

**Author:** ![Nico\_K](https://avatars.discourse-cdn.com/v4/letter/n/46a35a/32.png) [@Nico\_K](https://forum.ansible.com/u/Nico_K)\
**Post date:** [April 2, 2015, 7:10pm UTC](https://forum.ansible.com/t/ansible-ec2-quoting/17891/3 "2015-04-02T19:10:33Z")

</div>

Hi Ivan,

That’s the impression you would get from reading the error message (hence my comment behind it).  
In reality it’s something weird going on with the quote expansion, I say this because when you remove the “instance\_tags” it works as expected, also when I hardcode the instance\_tags (instead of passing them as a parameter, it works too), and lastly when I pass in the instance\_tags using "args: … " it also works.

Different sets of quoting show that either the “instance\_tags” do get passed in (using ansible-playbook -v), but with incorrect quoting or in the case where you get the authentication error the entire “instance\_tag” block is eaten away (no longer visible using -v).

Regards,  
Nico.

---

<div class="post-metadata">

**Author:** ![Nico\_K](https://avatars.discourse-cdn.com/v4/letter/n/46a35a/32.png) [@Nico\_K](https://forum.ansible.com/u/Nico_K)\
**Post date:** [April 2, 2015, 7:55pm UTC](https://forum.ansible.com/t/ansible-ec2-quoting/17891/4 "2015-04-02T19:55:09Z")

</div>

By the way, I just noticed that you run into the exact same issue when trying to define volumes by passing in a variable.  
For instance:

group\_vars/all:

ec2\_volumes:

- { “device\_name”: “/dev/sda1”, “volume\_size”: 50 }
- …

and then in roles/ec2/main.yml:

- name: ec2 test  
ec2:  
instance\_type: “{{ ec2\_instance\_type }}”  
…  
…  
volumes: “{{ ec2\_volumes }}”
