I'd welcome pull requests to add boolean support for tags (though when adding it, it should be done such that --list-hosts and --list-tasks is also aware of it, so ... utility functions and that sort of thing)
This syntax would look just like the host spec: --hosts "foo:&bar" as of course --hosts "foo:bar" would mean foo or bar. On Fri, Dec 6, 2013 at 1:12 AM, Michel Blanc <[email protected]>wrote: > On 06/12/2013 05:09, Gonzalo Servat wrote: > > I actually ran into this requirement today. For example: > > > > roles: > > - { role: network_config, tags: netconf } > > > > Inside that role, I might have a bunch of tasks defined that I want to > > run only for a particular tag so ideally I'd like to be able to specify: > > > > ansible-playbook .... -t netconf:ifcfg -t netconf:routes > > > > ... to run all tasks tagged with 'ifcfg' or 'routes', or I can choose to > > run all tasks in the network_config role: > > > > ansible-playbook .... -t netconf > > > > Can't do that with the current state of Ansible, right? > > AFAIK no. As a workaround, in 'foo' role, I define tag 'foo' everywhere, > then 'foo:install', 'foo:config', 'foo:bar', 'install', 'config', 'bar' > ... where appropriate, so I can execute a '-t config' to configure > roles only, or '-t foo:config' to configure foo role only, etc... > > This is tedious but I don't think there is another way. > > Set operations other than the current 'union' could be great (run all > tasks with tag X and Y, run all tasks except those with tags X) : > install only some roles, run only configuration steps for all roles > (skipping not apt/yum long operations), ... > > Another neat feature would be to tag all tasks for a role (e.g. set the > tag 'foo' for all plays in role foo). I don't think this is actually > possible (?), something like (tasks/main.yml) : > > - { include: install.yml, set_tags: [ 'foo', 'install' ] } > - { include: config.yml, set_tags: [ 'foo', 'config' ] } > > M > -- > Michel Blanc > { :github => "@leucos", :twitter => "@b9m", :gpg => "0X24B35C22" } > > -- > 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. > -- Michael DeHaan <[email protected]> CTO, AnsibleWorks, Inc. http://www.ansibleworks.com/ -- 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.
