Not really. I did a PoC of an action plugin that could do this, but we never really moved forward with it, and I don't know where the code is.
It basically executed the role 2 times from the action plugin, with a custom callback, and then reported whether the role had produced a change. On Wed, Jan 26, 2022 at 12:59 PM Richard Megginson <rmegg...@redhat.com> wrote: > 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. > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Development" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to ansible-devel+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-devel/CALF5A-L%3DMTt7r_0QimE9RK4STnPkceXR8zQ8YWUe-H4sP3EQxQ%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-devel/CALF5A-L%3DMTt7r_0QimE9RK4STnPkceXR8zQ8YWUe-H4sP3EQxQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- Matt Martz @sivel sivel.net -- You received this message because you are subscribed to the Google Groups "Ansible Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/CAD8N0v8421Gr%2BuUuRh242HxOry5%3Dm6CXMht3NSb%2BTzYgeKLFjA%40mail.gmail.com.