That was it Brent thanks a lot! You pointed me to the right direction. I
knew the ec2_tags was an option but I'd like to place the tags in the same
call. So I followed the same structured as you proposed:
vars:
key_name: mykey
instance_type: t2.micro
security_group: sg-xxxxxxxx
image: ami-f5b815e8
region: sa-east-1
subnet_id: subnet-5eaxxxxb
instance_tags:
foo: bar
tasks:
- name: Launch instance
local_action: ec2
key_name={{ key_name }}
group_id={{ security_group }}
instance_type={{ instance_type }}
image={{ image }}
wait=yes
region={{ region }}
assign_public_ip=yes
vpc_subnet_id={{ subnet_id }}
args:
instance_tags: "{{ instance_tags }}"
register: ec2
I will raise a PR adding this example to the documentation may anyone need
it.
If someone knows of a more elegant way of doing this please let me know.
Thanks
Hernandes
On Tuesday, July 22, 2014 2:53:52 PM UTC-3, Hernandes Sousa wrote:
>
> I'm having trouble setting up instance_tags in the following playbook:
>
>
> vars:
> key_name: mykey
> instance_type: t2.micro
> security_group: sg-xxxxxxxx
> image: ami-f5b815e8
> region: sa-east-1
> subnet_id: subnet-5eaxxxxb
> instance_tags:
> foo: bar
>
>
> tasks:
> - name: Launch instance
> local_action: ec2
> key_name={{ key_name }}
> group_id={{ security_group }}
> instance_type={{ instance_type }}
> image={{ image }}
> wait=yes
> region={{ region }}
> assign_public_ip=yes
> vpc_subnet_id={{ subnet_id }}
> *instance_tags="{{ instance_tags }}" # not working*
> register: ec2
>
>
> I get "msg: this module requires key=value arguments", does anyone know
> the correct way to add the dictionary in this case? I've tried a variety of
> combinations without much success.
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/129413f1-f855-4fe4-9569-e691379fe2e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.