# How to use notify with with\_items

**URL:** <https://forum.ansible.com/t/how-to-use-notify-with-with-items/24139>\
**Category:** Ansible Project\
**Created:** [April 4, 2017, 1:01pm UTC](https://forum.ansible.com/t/how-to-use-notify-with-with-items/24139 "2017-04-04T13:01:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![groupfiles14](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@groupfiles14](https://forum.ansible.com/u/groupfiles14)\
**Post date:** [April 4, 2017, 1:01pm UTC](https://forum.ansible.com/t/how-to-use-notify-with-with-items/24139/1 "2017-04-04T13:01:19Z")

</div>

i am downloading zip files from an url, i am using with\_items for list of zip files in that location, i want to do a task (extract) for only the file downloaded. Since i am new to ansible i cant think of anything other than using with\_items for downloading files, but i dont know how to make use of notify here, if i use notify below with\_items how it will invoke only the file it has downloaded. To summarise , i want to download zip files which are changed, extract only the files which are downloaded and install only the files which are extracted. Since with\_items has all the files listed in it , how can i achieve this workflow in ansible

---

<div class="post-metadata">

**Author:** ![groupfiles14](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@groupfiles14](https://forum.ansible.com/u/groupfiles14)\
**Post date:** [April 4, 2017, 3:52pm UTC](https://forum.ansible.com/t/how-to-use-notify-with-with-items/24139/2 "2017-04-04T15:52:52Z")

</div>

Why ansible forums is not so active all the time?

---

<div class="post-metadata">

**Author:** ![groupfiles14](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@groupfiles14](https://forum.ansible.com/u/groupfiles14)\
**Post date:** [April 5, 2017, 6:13pm UTC](https://forum.ansible.com/t/how-to-use-notify-with-with-items/24139/3 "2017-04-05T18:13:18Z")

</div>

ansiblers any help?

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [April 5, 2017, 10:19pm UTC](https://forum.ansible.com/t/how-to-use-notify-with-with-items/24139/4 "2017-04-05T22:19:04Z")

</div>

use win\_get\_url and with\_items with a list of zips you want to download, and also use ‘register’ to capture which files were downloaded into a variable with a name like download\_list. Also set ‘force=no’ on win\_get\_url so that it only fetches each zip once.

Then you can use the results in download\_list to make a new list of zips that need extracting ( changed=true) and call win\_unzip with the zips that were changed.

use the debug module

- name: show contents of download list  
debug  
var: download\_list

to see what has been downloaded

This will work fine until you have a zip file that won’t unzip. In which case you will either have to remove the (broken) zip file and re-run your playbook, or perhaps change the ‘force=no’ to ‘force=yes’.

Hope this helps.

Jon

---

<div class="post-metadata">

**Author:** ![groupfiles14](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@groupfiles14](https://forum.ansible.com/u/groupfiles14)\
**Post date:** [April 17, 2017, 5:51am UTC](https://forum.ansible.com/t/how-to-use-notify-with-with-items/24139/5 "2017-04-17T05:51:13Z")

</div>

> Then you can use the results in download\_list to make a new list of zips that need extracting ( changed=true) and call win\_unzip with the zips that were changed

How can i do this?

---

<div class="post-metadata">

**Author:** ![groupfiles14](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@groupfiles14](https://forum.ansible.com/u/groupfiles14)\
**Post date:** [April 17, 2017, 5:51am UTC](https://forum.ansible.com/t/how-to-use-notify-with-with-items/24139/6 "2017-04-17T05:51:59Z")

</div>

Should i use “when” here?

---

<div class="post-metadata">

**Author:** ![groupfiles14](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@groupfiles14](https://forum.ansible.com/u/groupfiles14)\
**Post date:** [April 18, 2017, 2:03pm UTC](https://forum.ansible.com/t/how-to-use-notify-with-with-items/24139/7 "2017-04-18T14:03:03Z")

</div>

ansiblers any help?

---

<div class="post-metadata">

**Author:** ![acharya\_tejaswi\_indu](https://avatars.discourse-cdn.com/v4/letter/a/41988e/32.png) [@acharya\_tejaswi\_indu](https://forum.ansible.com/u/acharya_tejaswi_indu)\
**Post date:** [April 18, 2017, 4:09pm UTC](https://forum.ansible.com/t/how-to-use-notify-with-with-items/24139/8 "2017-04-18T16:09:13Z")

</div>

Hi,

These two link may help you

1. [http://docs.ansible.com/ansible/win\_get\_url\_module.html](http://docs.ansible.com/ansible/win_get_url_module.html)
2. [http://docs.ansible.com/ansible/win\_unzip\_module.html](http://docs.ansible.com/ansible/win_unzip_module.html)

Thanks,
