Hi Xie,

We solved the problems with the yum repos an other way.

Maybe a way to solve this is by using when with your task. You pass a
variable with your role and check that with the when clause of your task.

If you for example define your role the following way:
- { role: foo_role, execute: false }

And then in your task you say:
- command: /bin/something
  when: execute


Mattias

2014-01-31 Chaoran Xie <[email protected]>:

> Hi Vincent,
>
> Did you guys ever find a way to "run this role but only those tasks who
> have the following tags. That way you don't need to specify them on the
> command line".  It seems that at one point Michael DeHaan said it below
> that this is what tags already do but i wasnt able to get it to work. And
> the suggestion for breaking things into multiple roles and uses
> dependencies does not really apply to what i want to do.
>
>
>
>
> On Tuesday, April 30, 2013 8:31:11 AM UTC-4, Vincent Van der Kussen wrote:
>
>> Michael,
>>
>> I think this is what Mattias means :
>>
>> In a role you could tag several tasks. In your playbook you could say  :
>> I want to run this role but only those tasks who have the following tags.
>> That way you don't need to specify them on the command line.
>>
>> It would be like  a "collection" of tasks where you can choose from using
>> tags. In this case yum repos.
>>
>> Vincent
>>
>>
>>
>>
>> On Tue, Apr 30, 2013 at 2:23 PM, Michael DeHaan <[email protected]>wrote:
>>
>>>  " Now we need to add --tags needed-repos when we execute our playbook."
>>>
>>> Actually, that's not quite the case, you need to specify "--tags
>>> needed-repos" only when you specify --tags.    If you don't specify --tags,
>>> all tags will run, including untagged items.
>>>
>>> The solution is to untag the steps that you always need to run every
>>> single time.
>>>
>>>
>>>
>>>
>>> On Tue, Apr 30, 2013 at 4:41 AM, Vincent Van der Kussen <
>>> [email protected]> wrote:
>>>
>>>> Hi,
>>>>
>>>> I also like my colleague's idea because in some cases you don't know
>>>> (or want to know)  which tags you need for a certain role. so +1 for this.
>>>>
>>>>
>>>>
>>>>
>>>> On Tue, Apr 30, 2013 at 10:36 AM, Mattias Gees <[email protected]>wrote:
>>>>
>>>>>  I think it would be a good idea to make it possible to invoke tags
>>>>> when you define a role in you playbook.
>>>>> For example we have a yum-repos roles with multiple repository
>>>>> definitions in it. All these repository's are tagged (epel-repo,
>>>>> company-repo, ...). Now we need to add --tags needed-repos when we execute
>>>>> our playbook. I am in favor to add an extra variable like 'with_tags' to
>>>>> the roles definition in the main playbook.
>>>>>
>>>>> Here is an example:
>>>>> roles:
>>>>> - { role: foo, var: 8888, with_tags: [ 'epel_repo', 'company_repo' ] }
>>>>>
>>>>> With this change I think it is possible to reduce the amount of roles.
>>>>>
>>>>> Let me now what you think.
>>>>>
>>>>> Regards,
>>>>> Mattias
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>  --
>>>>> 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].
>>>>>
>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>
>>>>>
>>>>>
>>>>
>>>>  --
>>>> 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].
>>>>
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>>
>>>  --
>>> 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].
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
> 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].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to