This might be old'ish style at this point, but this is how I do it:

    - name: tag my launched instances
      local_action: ec2_tag resource={{ item.id }} region={{ region }}
state=present
      with_items: ec2.instances
      args:
       tags:
        Name: "{{assigned_hostname.stdout}}"
        color: "{{oscar_color.stdout}}"
        environment: "{{oscar_environment}}"
        os: "{{os}}"
        owner: "{{owner}}"
        phi: "{{phi}}"
        pool: "{{pool}}"
        primary_role: "{{primary_role}}"
        branch: "{{branch}}"

Hope that helps.

--------
Brent
--------


On Tue, Jul 22, 2014 at 1:53 PM, Hernandes Sousa <[email protected]>
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/99f1a77f-35f6-4920-b260-04ff433f245d%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/99f1a77f-35f6-4920-b260-04ff433f245d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CABta7G2n8MAfHWWU4o3iD%3D-HEotFRmxOPHyfFVvScgH5%2BzEtow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to