"change handler (r) is not defined" problem

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
enabled=1
gpgcheck=0

Is this a bug or my configuration is wrong?

Regards,

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