Hi
I am using ansible-playbook version 1.8.2.
I have the following task in my ansible playbook that needs to invoke a set
of handlers whenever the config file changes:
- name: ceilometer proxy config
template: src=ceilometer_proxy_config.j2
dest=/usr/local/share/monitoring-channel-1_ceilometer_proxy_config mode=0777
notify:
- restart monitoring-channel
I am observing that the actual file on the target machine changes, but
ansible reports the whole operation as "changed: false" as shown below so
that notify handlers are not getting invoked.
<10.0.0.3> EXEC ssh -C -tt -q -o ControlMaster=auto -o ControlPersist=60s
-o ControlPath="/root/.ansible/cp/ansible-ssh-%h-%p-%r" -o
StrictHostKeyChecking=no -o IdentityFile="/opt/xos/synchronizers/m
onitoring_channel/sys/MonitoringChannel_1.key" -o
KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o User=ubu
ntu -o ConnectTimeout=10 10.0.0.3 /bin/sh -c 'sudo -k && sudo -H -S -p
"[sudo via ansible, key=cdmmgwzmnomzpfikxmbzpqyxcoiiwlsy] password: " -u
root /bin/sh -c '"'"'echo SUDO-SUCCESS-cdmmgwzmnomzpfik
xmbzpqyxcoiiwlsy; rc=flag; [ -r
"/usr/local/share/monitoring-channel-1_ceilometer_proxy_config" ] || rc=2;
[ -f "/usr/local/share/monitoring-channel-1_ceilometer_proxy_config" ] ||
rc=1; [ -d "/usr/l
ocal/share/monitoring-channel-1_ceilometer_proxy_config" ] && rc=3; python
-V 2>/dev/null || rc=4; [ x"$rc" != "xflag" ] && echo "${rc}
/usr/local/share/monitoring-channel-1_ceilometer_proxy_config"
&& exit 0; (python -c '"'"'"'"'"'"'"'"'import hashlib;
print(hashlib.sha1(open("/usr/local/share/monitoring-channel-1_ceilometer_proxy_config",
"rb").read()).hexdigest())'"'"'"'"'"'"'"'"' 2>/dev/null
) || (python -c '"'"'"'"'"'"'"'"'import sha;
print(sha.sha(open("/usr/local/share/monitoring-channel-1_ceilometer_proxy_config",
"rb").read()).hexdigest())'"'"'"'"'"'"'"'"' 2>/dev/null) || (echo "0 /
usr/local/share/monitoring-channel-1_ceilometer_proxy_config")'"'"''
<10.0.0.3> EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o
ControlPath="/root/.ansible/cp/ansible-ssh-%h-%p-%r" -o
StrictHostKeyChecking=no -o IdentityFile="/opt/xos/synchronizers/monit
oring_channel/sys/MonitoringChannel_1.key" -o
KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o User=ubuntu
-o ConnectTimeout=10 10.0.0.3 /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo
via ansible, key=vclkghiatnbspgrortpgrtspkuxxaxya] password: " -u root
/bin/sh -c '"'"'echo SUDO-SUCCESS-vclkghiatnbspgrortpg
rtspkuxxaxya; LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python ; rm
-rf /home/ubuntu/.ansible/tmp/ansible-tmp-1462993325.34-125201446134255/
>/dev/null 2>&1'"'"''
ok: [10.0.0.3] => {"changed": false, "gid": 0, "group": "root", "mode":
"0777", "owner": "root", "path":
"/usr/local/share/monitoring-channel-1_ceilometer_proxy_config", "size":
389, "state": "file",
"uid": 0}
Not sure why the “changed” flag is false even though the file content is
changing on the target machine. For ex:
Before file change, the following is the timestamp of the file:
ubuntu@mysite-ceilometer-1:~$ ls -alrt /usr/local/share/
total 28
-rwxrwxrwx 1 root root 389 May 11 18:52
monitoring-channel-1_ceilometer_proxy_config
drwxr-xr-x 6 root root 4096 May 11 18:52 .
And after change of the file:
ubuntu@mysite-ceilometer-1:~$ ls -alrt /usr/local/share/
total 28
-rwxrwxrwx 1 root root 422 May 11 19:11
monitoring-channel-1_ceilometer_proxy_config
drwxr-xr-x 6 root root 4096 May 11 19:11 .
I have even compared the hash of files using the same commands (
hashlib.sha1, sha.sha) before and after change which is indeed different.
Could any one help me with this issue and how I can troubleshoot what is
going wrong here? Plz let me know if you need more details.
Thanks
Srikanth
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/46083a13-40a4-4835-a52b-e7758d1f3e71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.