Ansible + EC2 & Quoting.

45 views
Skip to first unread message

Nico K.

unread,
Apr 2, 2015, 11:17:43 AM4/2/15
to ansible...@googlegroups.com
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


Ivan S. Freitas

unread,
Apr 2, 2015, 2:54:24 PM4/2/15
to ansible...@googlegroups.com
On Thu, Apr 2, 2015 at 12:17 PM, Nico K. <nkrab...@gmail.com> wrote:

> 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...

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

--
Ivan Sichmann Freitas

Nico K.

unread,
Apr 2, 2015, 3:10:33 PM4/2/15
to ansible...@googlegroups.com
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.

Nico K.

unread,
Apr 2, 2015, 3:55:09 PM4/2/15
to ansible...@googlegroups.com
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 }}"




Reply all
Reply to author
Forward
0 new messages