As per my role [root@ansible-master tasks]# cat main.yml
--- # tasks file for Security_Info_Tab8 - shell: grep -v ^\#
/etc/xinetd.d/telnet | grep -i disable register: telnet_setting
changed_when: false - assert: that: - lookup('file',
'customer-expects.txt') == telnet_setting.stdout fail_msg: missed
success_msg: matched
+++
The customer-expects.txt mentioned is [root@ansible-master /]# cat
customer-expects.txt
root
+++
When the playbook is run [root@ansible-master /]# ansible-playbook
tab8.role.yml -v the below output is displayed as expected
Using /etc/ansible/ansible.cfg as config file PLAY [This output is for
Tab-8 of Function Design document]
*****************************************************************************
TASK [Gathering Facts]
******************************************************************************************************************
ok: [ansible-client1] TASK [telnet_setting_tab8 : shell]
******************************************************************************************************
ok: [ansible-client1] => {"changed": false, "cmd": "grep -v ^\\#
/etc/xinetd.d/telnet | grep -i disable", "delta": "0:00:00.009030", "end":
"2022-01-21 15:08:03.157469", "rc": 0, "start": "2022-01-21
15:08:03.148439", "stderr": "", "stderr_lines": [], "stdout": "disable no",
"stdout_lines": ["disable no"]} TASK [telnet_setting_tab8 : assert]
*****************************************************************************************************
fatal: [ansible-client1]: FAILED! => { "assertion": "lookup('file',
'customer-expects.txt') == telnet_setting.stdout", "changed": false,
"evaluated_to": false, "msg": "missed" } PLAY RECAP
******************************************************************************************************************************
ansible-client1 : ok=2 changed=0 unreachable=0 failed=1 skipped=0 rescued=0
ignored=0
+++
As per the output its Ansible value does not match the customer expected
value (this is what we are expecting), however I need to go a step further
and print difference (output) of these two values within the same role. Any
suggestion or advise would be of great assistance.
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/c9c7437e-b97f-48b4-9d78-8518b7507535n%40googlegroups.com.