Great! Then I just told you how to do it.

vars:
   mytags:
      fred: frederick
      rod: roderick

- module_whatever:
     [...]
     tags: "{{ mytags }}"
     [...]

Or if you have the IDs of the resources you want to tag, use the ec2_tag
module.

Regards, K.


On Wed, Jan 30, 2019 at 10:27 AM Rafael Tomelin <[email protected]>
wrote:

> Hi,
>
> This tag in ansible.  I need set key and value (- key: value), but in
> variable.
>
> On Tue, Jan 29, 2019 at 7:36 PM Karl Auer <[email protected]> wrote:
> >
> > What kind of tag? Do you mean an ansible tag, or a tag for e.g. Amazon
> resources?
> >
> > If you mean Ansible tags, I do not know.
> >
> > If you mean AWS tags, most resource modules provide a "tags" attribute,
> if the resource supports tags. Some resources (generally those with IDs)
> can be tagged using the ec2_tag module.
> >
> > Regards, K.
> >
> >
> > On Tue, Jan 29, 2019 at 11:25 PM Rafael Tomelin <
> [email protected]> wrote:
> >>
> >> Hi dear,
> >>
> >> I need create tag in my role, this example:
> >>
> >> vars/main.yml
> >> name_variable:
> >>     tags:
> >>        key1: value1
> >>        key2: value2
> >>
> >> in tasks
> >> taks/main.yml
> >>
> >> - name: name my task
> >>   user: name
> >>   tags:
> >>      tags from vars
> >>
> >>
> >> how can create this tags?
> >>
> >>
> >> --
> >> Atenciosamente,
> >>
> >> Rafael Tomelin
> >> Tel.: 51-84104084
> >> Skype: rafael.tomelin
> >>
> >> LPI ID: LPI000191271
> >>
> >> --
> >> 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/CAGEUqbBU%2BN0Byj2aLUDLRwCPgLcYN8X%2BA9yMTns4F5QL0okezQ%40mail.gmail.com
> .
> >> For more options, visit https://groups.google.com/d/optout.
> >
> >
> >
> > --
> > Karl Auer
> >
> > Email  : [email protected]
> > Website: http://2pisoftware.com
> >
> > GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
> > Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA
> >
> > --
> > 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/CA%2B%2BT08S%3DyOXkTpApiE1om%3D8DcpnT%2Bp8673ZyQshSqeoTAd%2B8iQ%40mail.gmail.com
> .
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Atenciosamente,
>
> Rafael Tomelin
> Tel.: 51-84104084
> Skype: rafael.tomelin
>
> LPI ID: LPI000191271
>
> --
> 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/CAGEUqbCX98-Nw_B18MkgSCu87o5oSmHvKdttg4YqnL8%2BB4K8bw%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Karl Auer

Email  : [email protected]
Website: http://2pisoftware.com

GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA

-- 
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/CA%2B%2BT08QVVcjwLxDCDTOuZc0_sLc9s9upM-06_zo-RZnZnE3Yxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to