Skip to content

Async roles appear to invert changed status using "changed_when: not <async_result>.changed" #1393

Description

@BigT-77

Collection: infra.aap_configuration
Version: 4.8.2

Observed behavior:

Several async-enabled roles appear to invert Ansible change reporting.

Example:

roles/gateway_authenticators/tasks/main.yml

contains:

register: __gateway_authenticators_job_async
changed_when: not __gateway_authenticators_job_async.changed

Testing performed:

  1. Disable authenticator in AAP UI.
  2. Run role.
  3. Authenticator is successfully re-enabled.
  4. Task reports OK instead of CHANGED.

After changing:

changed_when: not __gateway_authenticators_job_async.changed

to:

changed_when: __gateway_authenticators_job_async.changed

the task correctly reports CHANGED when drift exists and OK when no changes are required.

Additionally, check mode fails because the role uses async:

check mode and async cannot be used on same task

Environment:

AAP Version: 4.7.11
infra.aap_configuration: 4.8.2

The issue appears to affect many roles.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnewNew issue, this should be removed once reviewed

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions