Is there some way inside of a playbook to see if a role changed something? The use case is this:
tests_of_my_role.yml:
-
name: call role to see if working
include_role:
name: my_role
vars: -
my role vars
-
set_fact:
__role_changes_before: “{{ _tqm._stats.changes }}” -
name: call role again to see if idempotent
include_role:
name: my_role
vars: -
my role vars
-
assert:
that: __role_changes_before == _tqm._stats.changes
msg: Role is not idempotent!
I’m assuming it would be possible to keep track of the changes with a callback plugin, but I’m not sure how the callback would make the “num_of_changes” variable available at the playbook scope.