-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tags from various levels should sum together. #5622
Comments
I'm finding these diffs a little hard to read, can you reformat this so to just show the files in question (or to maybe link a gist?) Thanks! |
Indeed I wasn't sure if it is a good way to share the example. The best would probably be tar.gz/zip. It should be possible to copy the content of the diff above to a file (i.e. 1.patch) and run: patch -p1 < 1.patch |
NONE is not a valid tag for devel ...
Dropping the NONE tag, I get the following result ..
Note that none of the included task files were run. This is the output when no tags are specified:
|
Preliminary patch:
|
@LukaszC this should be fixed based on my understanding of the issue. |
@jctanner Does it also merge tags from multiple level of includes? I'd like to give my role a top-level tag which is inherited to all tasks below and additionally tag individual tasks
As an end result, I'd like to be able to run playbook either with
|
* Change example syntax on supervisorctl module * Change example syntax or _ec2_ami_search module * Change example syntax on cloudformation module * Change example syntax on ec2 module * Change example syntax on ec2_facts module * Change example syntax on ec2_eip module * Change example syntax on rds module * Change example syntax on route53 module * Change example syntax on s3 module * Change example syntax on digital_ocean module * Change example syntax on docker_service module * Change example syntax on cloudformation module * Change example syntax on gc_storage module * Change example syntax on gce module * Change example syntax on gce_mig module * Change example syntax on _glance_image module * Change example syntax on _keystone_user module * Change example syntax on _nova_keypair module * Change example syntax on _quantum_floating module * Change example syntax on _quantum_floating_ip_associate module * Change example syntax on _quantum_network module * Change example syntax on _quantum_router module * Change example syntax on _quantum_router_gateway module * Change example syntax on _quantum_router_interface module * Change example syntax on _quantum_subnet module * SQUASH _quantum_subnet * Add missing quotes
We've noticed that tags assigned on various levels (playbook, tasks include) does not sum together but are rather overridden (counterintuitive I think).
Lets assume that I have two roles (roleA and roleB), in addition roleA depends on roleB.
Each role consists of two files in tasks/ subdirectory, main.yml and tasks.yml, where main.yml simply includes tasks.yml and assigns tag "tagRoleA". Same structure is for true for roleB, but the tag is called "tagRoleB". task.yml contains only one debug task.
Now, my playbook defines play with only one role: { role: roleA, tags: tagPlay }, as you can see we provide tags to the role "invocation" in playbook.
The behaviour I would expect it that roleA fires when we run ansible-playbook with following tags: NONE, tagPlay, tagRoleA. Moreover roleB will be invoked always when roleA is triggered.
However the behaviour is rather surprising (at least for me). When we run the playbook with tag "tagPlay", then we get error message that "tagPlay" is an unknown tag and only "tagRoleA" and "tagRoleB" are recognized as valid tags. When we run the playbook with tag "tagRoleA" then only roleA will be fired, roleB will not be triggered.
As far as I've managed to notice it is the include+tags definition which makes i.e. the tags defined at playbook level to disappear, but it is very convenient combination if you consider it together with issue: #5512
$ ansible --version
ansible 1.4.3
The text was updated successfully, but these errors were encountered: