# "change handler (r) is not defined" problem

**URL:** <https://forum.ansible.com/t/change-handler-r-is-not-defined-problem/11581>\
**Category:** Ansible Project\
**Created:** [May 28, 2012, 7:02pm UTC](https://forum.ansible.com/t/change-handler-r-is-not-defined-problem/11581 "2012-05-28T19:02:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Duy\_Thang](https://avatars.discourse-cdn.com/v4/letter/d/a9a28c/32.png) [@Duy\_Thang](https://forum.ansible.com/u/Duy_Thang)\
**Post date:** [May 28, 2012, 7:02pm UTC](https://forum.ansible.com/t/change-handler-r-is-not-defined-problem/11581/1 "2012-05-28T19:02:56Z")

</div>

Hello,

I’m using ansible-0.4 and have a problem. I write a play to update openssh-server pkg, copy new sshd config to server, then restart the sshd service. The first time I run the playbook, it’s works. But when I rerun it, the ansible-playbook stop right after copy action done, with this error:

> ERROR: change handler (r) is not defined

If I make a change to playbook file (add a new blank line, or a space), it works again.

This happen when the one yum repo configuration file on remote server miss the name parameter (see the repo file below). This is full output of ansible-playbook:

> SETUP PHASE \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

> 

> ok: [192.168.6.4]

> 

> TASK: [ensure openssh-server is latest] \*\*\*\*\*\*\*\*\*

> 

> fatal: [192.168.6.4] =\> failed to parse: Repository ‘remi’ is missing name in configuration, using id
> 
> {“changed”: false}  
> /Repository ‘remi’ is missing name in configuration, using id
> 
> {“changed”: false}  
> /yum pkg=openssh-server state=latest

> 

> TASK: [copy the ssh config file] \*\*\*\*\*\*\*\*\*

> 

> ERROR: change handler (r) is not defined

This is my play:

> - hosts: chinfon
> 
> tasks:
> 
> - name: ensure openssh-server is latest  
> action: yum pkg=openssh-server state=latest
> - name: copy the ssh config file  
> action: copy src=tpl/sshd\_config dest=/etc/ssh/sshd\_config owner=root group=root mode=600  
> notify: restart sshd
> 
> handlers:
> 
> - name: restart sshd  
> action: service name=sshd state=restarted

And this is my repo file on remote server:

> [remi]
> 
> # missing name config
> 
> mirrorlist=[http://rpms.famillecollet.com/enterprise/$releasever/remi/mirror](http://rpms.famillecollet.com/enterprise/$releasever/remi/mirror)  
> enabled=1  
> gpgcheck=0

Is this a bug or my configuration is wrong?

Regards,

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [May 29, 2012, 1:12am UTC](https://forum.ansible.com/t/change-handler-r-is-not-defined-problem/11581/2 "2012-05-29T01:12:51Z")

</div>

It looks like this is the root of the problem:

> fatal: [192.168.6.4] =\> failed to parse: Repository 'remi' is missing name in configuration, using id

"

In this case, the module is returning non-JSON (possibly some noise on standard error, which is not separate from the stdout stream due to the way paramiko sudo mode has to work) so it's counting that as a failure. The other problem seems to stem from that.

--Michael
