This has been discussed in the past. The solution proposed before is to make sure the tag in question gets tagged with a known tag, like "common".
I'm definitely objecting to reuse of the wildcard pattern matching "*" (it would imply other patterns could be used), but we were worried in the past that "all" might exist in existing playbooks and did not want to damage backwards compatibility either. A change in tag logic could potentially be potentially dangerous as what a play does in automation tomorrow could be very different after an upgrade. I think your proposal *might* be interesting if it was treated as an fnmatch pattern, but tags do not work this way, because what they do is affix a tag to the task, and then the system looks through and sees if any tags match the input. Thus we are technically able to see what all the tags used in a playbook are, and specifying --tags thisIsATypo can actually tell you that the tag was named something else. This becomes problematic when tags are fnmatch expressions, because then technically the playbook would support any kind of tag. So the solution of tagging those steps "common" is a good one, because you can run multiple tags at the same time --tags "common,app_config", etc. On Mon, Sep 8, 2014 at 6:09 AM, Dmitry Malinovsky <[email protected] > wrote: > Hello, > > If I repeat someone, please, point me in the right direction. > > I'm not the only guy who wants pre_task and post_tasks to work like > setup/teardown methods and run regardless of any specified tags. Here is > the discussion: > https://groups.google.com/forum/#!msg/ansible-project/VxD39ABi1z4/8wrjJn7mh74J > > So my proposal is to have a special tag name - * (star) which will force a > task to run regardless of specified tags. This will help to be more > verbose, and will only affect tasks which were manually tagged with such > tag. > > Consider the example below: > *aerospike.yml* > --- > - hosts: aerospike > pre_tasks: > - name: Configure repository > file: src=aerospike.repo dest=/etc/yum.repos.d/aerospike.repo > state=file > tags: "*" > tasks: > - name: Install aerospike > yum: name=aerospike-server state=installed > tags: deploy > - name: Configure aerospike > shell: ./something.sh > tags: configure > > Running `ansible-playbook -i inventory aerospike.yml --tags 'deploy'` will > affect both pre_tasks and installation task. > It does not mean that you can't skip tasks tagged with star sign - you > still can specify additional tags and pass them to --skip-tags > > Thanks > > -- > 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/675e274f-ffdb-49a6-be0d-dbe418d8cea8%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/675e274f-ffdb-49a6-be0d-dbe418d8cea8%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/CA%2BnsWgwdYwZr70rBvTurL56SxCpE386VnapieHMo_ZQUcym61A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
