ansible : how to use the variable ${item} from with_items in notify?


I am new to Ansible and I am trying to create several virtual environments (one for each project, the list of projects being defined in a variable).

The task works well, I got all the folders, however the handler does not work, it does not init each folder with the virtual environment. The ${item} varialbe in the handler does not work.
How can I use an handler when I use with_items ?


Handlers are just ‘flagged’ for execution once whatever (itemized sub-)task requests it (had the changed: yes in its result).
At that time handlers are just like a next regular tasks, and don’t know about the itemized loop.

A possible solution is not with a handler but with an extratask + conditional

Something like

Leave a Reply