Using variables from a notifying task in a handler

I have a task that iterates over a dictionary of directory names to remove a file:

  • name: Remove conflicting XACML policy

file: path=/opt/fedora/{{ item.key }}/data/blah.xml

state=absent

with_dict: installs

notify: Reload XACML

If the file is removed, a handler is required to restart a process to re-read the directory of policies. I’d like to do something like this:

  • name: Reload XACML
    shell: fedora-reload-policies.sh
    chdir=/opt/fedora/{{ item.key }}/server/bin

But what I get is an undefined-variable error:

NOTIFIED: [fedora-sites | Reload XACML] ***************************************
<10.11.12.16> ESTABLISH CONNECTION FOR USER: vagrant
fatal: [10.11.12.16] => One or more undefined variables: ‘item’ is undefined

FATAL: all hosts have already failed – aborting

Is what I’m trying to do possible?

Peter

This is unfortunately not possible.