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

Allow passing other tags when using untagged (--tags=untagged,tag1,tag2 -> tag1 and tag2 should also run) #11844

Open
tamastarjanyi opened this Issue Aug 4, 2015 · 2 comments

Comments

Projects
None yet
4 participants
@tamastarjanyi

tamastarjanyi commented Aug 4, 2015

ISSUE TYPE

Feature Idea

COMPONENT NAME

core

ANSIBLE VERSION
1.9.2
CONFIGURATION
OS / ENVIRONMENT

Ubuntu 15.04

SUMMARY

Not sure this is a bug or intentional but in my oppinion in case parameter --tags=untagged,tag1,tag2 is passed to ansible-playbook tag1 and tag2 should be used and both tasks with no tags and tasks with listed tags should be used. But ansible is running only untagged tasks in such situation.

The corresponding code part is the tasks_to_run_in_play() function in playbook/__init__.py

Original code:

    elif 'untagged' in self.only_tags:
        if task_set == u:
            should_run = True

Proposed fix:

    elif 'untagged' in self.only_tags and task_set == u:
        should_run = True

Download a demo playbook.
Try the followings to reproduce the issue:

ansible-playbook bug/site.yaml --tags=untagged,tag1 # BAD?: Should run tasks with no tag and tagged with tag1 tag
ansible-playbook bug/site.yaml --tags=untagged # GOOD: Runs untagged
ansible-playbook bug/site.yaml --tags=tag1 # GOOD: Runs tasked tagged with tag1
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
@bcoca

This comment has been minimized.

Member

bcoca commented Aug 4, 2015

my intention was that when using untagged you only ran untagged, But I'll consider this a feature request.

@bcoca bcoca added the feature_idea label Aug 4, 2015

@bcoca bcoca changed the title from passing untagged parameter prevents using any named tag (--tags=untagged,tag1,tag2 -> tag1 and tag2 are not working) to Allow passing other tags when using untagged (--tags=untagged,tag1,tag2 -> tag1 and tag2 should also run) Aug 4, 2015

@luhkevin

This comment has been minimized.

luhkevin commented Mar 6, 2016

Is there any progress on this feature? I feel like this should have been the default behavior anyhow. There's a lot of situations where you have a common set of tasks for all hosts, and specific tasks for only some hosts.

To emulate this behavior, I would have to take the complement of the task-tags I want and pass it in to --skip-tags, so it feels backwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment