Discrepancy between play recap and ansible output.

Hi,

I have a playbook which ends with:

PLAY RECAP ********************************************************************
192.168.228.201 : ok=69 changed=1 unreachable=0 failed=0
192.168.228.223 : ok=67 changed=1 unreachable=0 failed=0

But I can’t find the one tasks marked as changed…
In the output I can only see ok, or skipped…

How can I track this discrepancy ?

ansible: ansible-1.3.3-1.el6.noarch
OS: centos 6.4

Thank you,

Julien.

Please show us the entire run output with -v.

Ok, I found it

TASK: [Install the Root CA] *******************************************
failed: [192.168.228.201] => {“changed”: true, “cmd”: "/usr/bin/keytool -import -file /etc/ssl/certs/RootCA.crt -alias RootCA -storepass mypasswd -keystore /etc/pki/java/cacerts -noprompt ", “delta”: “0:00:00.233156”, “end”: “2013-11-08 14:06:57.877999”, “item”: “”, “rc”: 1, “start”: “2013-11-08 14:06:57.644843”}
stdout: keytool error: java.lang.Exception: Certificate not imported, alias already exists
…ignoring
failed: [192.168.228.223] => {“changed”: true, “cmd”: "/usr/bin/keytool -import -file /etc/ssl/certs/RootCA.crt -alias RootCA -storepass mypasswd -keystore /etc/pki/java/cacerts -noprompt ", “delta”: “0:00:00.296027”, “end”: “2013-11-08 14:06:58.110633”, “item”: “”, “rc”: 1, “start”: “2013-11-08 14:06:57.814606”}
stdout: keytool error: java.lang.Exception: Certificate not imported, alias already exists
…ignoring

The task is defined like that:

  • name: Install the Root CA
    shell: /usr/bin/keytool -import -file /etc/ssl/certs/RootCA.crt -alias RootCA -storepass mypasswd -keystore /etc/pki/java/cacerts -noprompt
    ignore_errors: True

Is it the normal behavior ?

thanks.

command and shell modules always return changed=true, so you are seeing the expected behavior. If you want to alter the behavior, use the changed_when keyword …

Or the creates= or removes= options to the command module.