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

Module 'group_by' report changed even with 'changed_when: false' #70844

Closed
chemnic opened this issue Jul 23, 2020 · 3 comments · Fixed by #70919
Closed

Module 'group_by' report changed even with 'changed_when: false' #70844

chemnic opened this issue Jul 23, 2020 · 3 comments · Fixed by #70919
Assignees
Labels
affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. inventory Inventory category module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@chemnic
Copy link

chemnic commented Jul 23, 2020

SUMMARY

After upgrade from 2.9.10 to 2.9.11 I noticed the module 'group_by' is reporting 'changed'.
This is because this change in #69860
The problem is that it is reporting 'changed' even with changed_when: false added to the task.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

group_by

ANSIBLE VERSION
2.9.11
CONFIGURATION

OS / ENVIRONMENT

Ubuntu 18.04 (control and target host)

STEPS TO REPRODUCE

As an example use the task:

- group_by:
    key: "os_{{ ansible_facts['distribution_file_variety'] }}"
  changed_when: false
  register: groupby

- debug:
    msg: "{{ groupby }}"
TASK [group_by_os : group_by] *******************************************************************************************************************************
changed: [srvd-test04]

TASK [group_by_os : debug] **********************************************************************************************************************************
ok: [srvd-test04] => 
  msg:
    add_group: os_Debian
    changed: true
    failed: false
    parent_groups:
    - all

PLAY RECAP **************************************************************************************************************************************************
srvd-test04                : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0 
EXPECTED RESULTS

The task should always return changed: false

ACTUAL RESULTS

The task return changed: true


@ansibot
Copy link
Contributor

ansibot commented Jul 23, 2020

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. inventory Inventory category module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Jul 23, 2020
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Jul 23, 2020
@bcoca bcoca self-assigned this Jul 23, 2020
@bcoca
Copy link
Member

bcoca commented Jul 27, 2020

note: this is a bit complicated as we evaluate changed/failed_when on the child before passing the results to the parent process, but the parent takes care of 'special' tasks like group_by/add_host/meta/etc and has not way to re-evalute those conditionals.

@chemnic
Copy link
Author

chemnic commented Jul 29, 2020

I tested the fix with devel+commits and can confirm is working.

@ansible ansible locked and limited conversation to collaborators Aug 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. inventory Inventory category module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants