Hello Michal,

thanks for your time & answer. I was asking because i wanted to extend the 
use of host(-group) patterns 
(http://docs.ansible.com/intro_patterns.html)... to tags.

It would allow for generic roles to provide tasks that don't get executed 
by default ... but can be triggered by providing a certain set of tags.

Imagine it was possible to do the following ...

ansible <playbook> --tags php-fpm,nginx,&service,&stop

which would match all tasks with exacly

- tags: [php-fpm, service, stop]
- tags: [nginx, service, stop]

... to stop the php-fpm and nginx service. 

I can imagine a lot of use-cases where this would come in handy. 

The idea came up while i was developing a "dashboard" for my development 
machine that would allow me to quickly change it's state by selecting tags 
(using autocompletion).

How cool would it be to just ... click together some expressive commands 
like "composer, install" , "mysql, install" ... and have the machine in the 
desired state.
 
It shouldn't be too hard to expose the provided tags as a variable + create 
a jinja function that can be used inside 'when' and evaluates the provided 
tags against the 'tags' variable ? 

What are your thoughts about this? Could you share some implementation tips 
or am I on the completely wrong track here?




Am Freitag, 12. September 2014 15:53:03 UTC+2 schrieb Michael DeHaan:
>
> No, this is not available, it doesn't really make sense for a task to know 
> what tags are available because it can't do anything with that information.
>
> Boolean operations other than "OR" on --tags is also not presently 
> available.
>
>
>
>
> On Fri, Sep 12, 2014 at 5:54 AM, Nicolai Froehlich <[email protected] 
> <javascript:>> wrote:
>
>> ---- Question
>>
>> Is it possible to access the list of provided tags ( --tags, --skip-tags 
>> ) from a variable inside a task?
>>
>> Is it maybe possible to access the invoked command itself from variable?
>>
>> Is it possible to use patterns (
>> http://docs.ansible.com/intro_patterns.html) with tags? 
>> Something like --tags=config,&reload would be very helpful.
>>
>> ------ Example
>>
>> Given i have:
>>
>> - task A with tags: [ config ] 
>> - task B with tags: [ config, reload ] 
>> - task C with tags: [ service, reload ]
>>
>> ---- Problem
>>
>> I'd like to skip task B if --tags does not contain 'config' AND 'reload'.
>>
>> Thanks in advance.
>>
>>
>>
>>
>>
>>
>>  -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/5c9e5307-59b7-4b30-b366-3b279cecdd4c%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/5c9e5307-59b7-4b30-b366-3b279cecdd4c%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/89927351-751a-4a2a-bc2a-a3ba76016356%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to