Kai, why would I use vars when I already have tags on my tasks which 
purpose, and only purpose, is filtering during execution?

Also as I said back in 2015 
https://groups.google.com/d/msg/ansible-project/WimzDEJLHJc/9U10Yjb4CQAJ it 
is hard to retrofit variables into hundreds of playbooks you have written 
with tags expecting they will serve the purpose they exist for, *which is 
filtering*.

>From where I stand, the "tags" option that we can pass to the role like 
this:

- roles:
    - { name: role1 tags: ["tag1","tag2"] }     <== this *IS/SHOULD BE* 
equivalent to a command line 

is pretty much useless since instead filtering the role's tasks based on 
that "tags" list it adds those tags to each of them. Really not sure how is 
this helping me in any way and what would be the use case or advantage I 
get from doing this? I mean if I wanted those tags in a role I would have 
included them in its tasks already ... or am I missing something?

So to conclude, when I call a role with *tags* I expect those and only 
those tags to be in effect during role's execution. Similarly I would 
expect to use *skip-tags* for tags I do not want executed during run time. 
Instead of that you are telling me to use vars when I already have tags 
that should serve the purpose.

Not sure why such a resistance towards a feature that is very logical to 
have and makes much more sense than what it is atm.

On Saturday, February 2, 2019 at 11:05:40 PM UTC+11, Kai Stian Olstad wrote:
>
> On 02.02.2019 05:39, Igor Cicimov wrote: 
> > Brian, I find the current usage of "tags" when calling a role via 
> > "roles:" 
> > or "include_role/import_role" is counter intuitive. The reason we tag 
> > tasks 
> > in our playbooks is for the purpose of filtering which we would expect 
> > to 
> > be the case in the above mentioned scenarios as well. But it is not, 
> > and 
> > that is major draw back in making reusable (DRY) code. 
> > 
> > I constantly find my self in need to execute just a part of some role 
> > tasks, lets say the ones tagged with "install" but skip the ones tagged 
> > with "configure" lets say. This is exactly what we get by passing 
> > "--tags" 
> > or "--skip-tags" on the command line so why not make this consistent 
> > everywhere? 
>
> I would argue that it's very consistent at the moment. 
> All tags in a yaml file sets/add that tag(s), and which tags you want to 
> run is specified on the command line. 
>
> Use variables if you want to run part of your code. 
> An example: 
>
> roles/test/install.yml 
> roles/test/configure.yml 
>
>
> roles/test/main.yml 
> --- 
> - include_tasks: install.yml 
>    when: test_install | default(true) == true 
>
> - include_tasks: configure.yml 
>    when: test_configure | default(true) == true 
>
> Then to only run install just do this 
> playbook.yml 
> - hosts: localhost 
>    roles: 
>      - role: test 
>        test_configure: false 
>
>
> You can also overwrite the variables on the command line too if needed. 
>
> -- 
> Kai Stian Olstad 
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3db1ef02-829b-4c06-b0e3-67d0643a480e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to