Skip to content
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

make fact gathering obey play tags #44717

Merged
merged 1 commit into from
Nov 6, 2018
Merged

Conversation

bcoca
Copy link
Member

@bcoca bcoca commented Aug 27, 2018

SUMMARY

fixes #44251, #21528

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

gathering

ANSIBLE VERSION
2.x

@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Aug 27, 2018
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Aug 27, 2018
@ansibot ansibot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Aug 28, 2018
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Sep 5, 2018
@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Sep 29, 2018
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Oct 7, 2018
@ansibot ansibot added the support:community This issue/PR relates to code supported by the Ansible community. label Oct 16, 2018
@ansibot ansibot added the core_review In order to be merged, this PR must follow the core review workflow. label Oct 24, 2018
@maxamillion
Copy link
Contributor

shipit

@ansibot ansibot added shipit This PR is ready to be merged by Core and removed core_review In order to be merged, this PR must follow the core review workflow. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Nov 6, 2018
@bcoca bcoca merged commit 4ec2423 into ansible:devel Nov 6, 2018
@bcoca bcoca deleted the fine_tune_gathering branch November 6, 2018 18:19
@felixfontein
Copy link
Contributor

felixfontein commented Nov 7, 2018

@bcoca @maxamillion this breaks facts gathering for playbooks which use tags, but don't have global tags:

- hosts: localhost
  tasks:
  - debug: msg="test"
    tags:
    - test

Behavior with ansible so far (ansible-playbook test.yml -t test):

PLAY [localhost] *********************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************
ok: [localhost]

TASK [debug] *************************************************************************************************************************************
ok: [localhost] => {
    "msg": "test"
}

PLAY RECAP ***************************************************************************************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0    skipped=0   

Behavior with this PR:

PLAY [localhost] *********************************************************************************************************************************

TASK [debug] *************************************************************************************************************************************
ok: [localhost] => {
    "msg": "test"
}

PLAY RECAP ***************************************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0    skipped=0   

@felixfontein
Copy link
Contributor

From discussion in IRC: changing test to

        # Unless play is specifically tagged, gathering should 'always' run
        if not self._play.tags:
            setup_task.tags = ['always']

works for me (i.e. this test).

@felixfontein
Copy link
Contributor

Will be fixed in #48294.

mjmayer pushed a commit to mjmayer/ansible that referenced this pull request Nov 30, 2018
Tomorrow9 pushed a commit to Tomorrow9/ansible that referenced this pull request Dec 4, 2018
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. shipit This PR is ready to be merged by Core support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fact gathering is NOT ignored when play level tags don't match
5 participants