# When changed

**URL:** <https://forum.ansible.com/t/when-changed/14139>\
**Category:** Ansible Project\
**Created:** [December 12, 2013, 1:11pm UTC](https://forum.ansible.com/t/when-changed/14139 "2013-12-12T13:11:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Maas](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Mark\_Maas](https://forum.ansible.com/u/Mark_Maas)\
**Post date:** [December 12, 2013, 1:11pm UTC](https://forum.ansible.com/t/when-changed/14139/1 "2013-12-12T13:11:28Z")

</div>

Hi List,

I’d like to run this tidbit:

- name: Patch | Patchen  
apt: update\_cache=yes upgrade=dist  
notify: reboot machine  
register: patched  
tags:

- ubuntu\_patch

- name: Patch | Logging ophalen  
fetch: dest=/media/storage/logs/ fail\_on\_missing=no src=/var/log/apt/{{ item }}  
with\_items:

- term.log

- history.log  
when: “patched is changed”  
tags:

- ubuntu\_patch

This will return with:  
TASK: [Patch | Logging ophalen] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [xmonopssla00] =\> error while evaluating conditional: patched is changed  
fatal: [xmonopssla01] =\> error while evaluating conditional: patched is changed  
fatal: [xmonopssla02] =\> error while evaluating conditional: patched is changed  
fatal: [xmonopsdb] =\> error while evaluating conditional: patched is changed  
fatal: [xmonopsview] =\> error while evaluating conditional: patched is changed  
fatal: [xmonopsodw] =\> error while evaluating conditional: patched is changed

FATAL: all hosts have already failed – aborting

We are using:

mmaas@xmgtansible:~/playbooks$ ansible --version  
ansible 1.4

Any idea’s what I’m doing wrong? 😉  
Mark

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [December 12, 2013, 3:16pm UTC](https://forum.ansible.com/t/when-changed/14139/2 "2013-12-12T15:16:50Z")

</div>

there’s no variable called changed, so it’s doing the wrong kind of test.

when: patched|changed # preferred

or

when: patched.changed # in some older versions of Ansible
