# stdout just md5sum and file name

**URL:** <https://forum.ansible.com/t/stdout-just-md5sum-and-file-name/16619>\
**Category:** Ansible Project\
**Created:** [October 27, 2014, 5:11pm UTC](https://forum.ansible.com/t/stdout-just-md5sum-and-file-name/16619 "2014-10-27T17:11:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_Tomazic](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@Simon\_Tomazic](https://forum.ansible.com/u/Simon_Tomazic)\
**Post date:** [October 27, 2014, 5:11pm UTC](https://forum.ansible.com/t/stdout-just-md5sum-and-file-name/16619/1 "2014-10-27T17:11:49Z")

</div>

I would like to md5sum two conf files server.xml and server.xml\_latest in the same folder on two instances on remote server. How can I get stdout just **“b9b82f9ad039e9d1b4c0233dbacf3934 /opt/tomcat-instance/fep21/conf/server.xml”** or somehow check if config file have same md4sum and stdout on screen like _Files have same_ _md5sum hash_ or _Files have_ _different md5sum hash!!!_

I have playbook thah look like that.

vars:

tc\_instances:

- tc\_inst\_name: tc20
- tc\_inst\_name: tc21

tasks:

- name: md5 → /opt/tomcat-instance/[TC\_INST]/conf/server.xml  
command: md5sum /opt/tomcat-instance/{{ item.tc\_inst\_name }}/conf/server.xml  
with\_items: tc\_instances  
register: md5\_server\_xml

- debug: msg={{ item.stdout }}  
with\_items: md5\_server\_xml.results

- name: md5 → /opt/tomcat-instance/[TC\_INST]/conf/server.xml\_latest  
command: md5sum /opt/tomcat-instance/{{ item.tc\_inst\_name }}/conf/server.xml\_latest  
with\_items: tc\_instances  
register: md5\_server\_xml\_latest

- debug: msg={{ item.stdout }}  
with\_items: md5\_server\_xml\_latest.results

and stdout on console like thaht

TASK: [debug msg={{ item.stdout }}] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

ok: [192.168.2.150] =\> (item={u’stdout’: u’b9b82f9ad039e9d1b4c0233dbacf3934 /opt/tomcat-instance/tc21/conf/server.xml’, u’changed’: True, u’end’: u’2014-10-27 13:41:39.234463’, ‘item’: {‘tc\_inst\_name’: ‘tc21’}, u ‘cmd’: [u’md5sum’, u’/opt/tomcat-instance/tc21/conf/server.xml’], u’rc’: 0, u’start’: u’2014-10-27 13:41:39.219446’, u’stderr’: u’‘, u’delta’: u’0:00:00.015017’, ‘invocation’: {‘module\_name’: u’command’, ‘module\_ar gs’: u’md5sum /opt/tomcat-instance/tc21/conf/server.xml’}}) =\> {  
“item”: {  
“changed”: true,  
“cmd”: [  
“md5sum”,  
“/opt/tomcat-instance/tc21/conf/server.xml”  
],  
“delta”: “0:00:00.015017”,  
“end”: “2014-10-27 13:41:39.234463”,  
“invocation”: {  
“module\_args”: “md5sum /opt/tomcat-instance/tc21/conf/server.xml”,  
“module\_name”: “command”  
},  
“item”: {  
“tc\_inst\_name”: “tc21”  
},  
“rc”: 0,  
“start”: “2014-10-27 13:41:39.219446”,  
“stderr”: “”,  
**“stdout”: “b9b82f9ad039e9d1b4c0233dbacf3934 /opt/tomcat-instance/fep21/conf/server.xml”**  
},  
“msg”: “b9b82f9ad039e9d1b4c0233dbacf3934”  
}

Thank you for help and suggestions.
