Hello All,

I need help to display only selective details from register variable task 
output . I have below code and output and need specific details. How to 
extract specific details the output.

Playbook:------------------------

---

- name: Run health checks

  hosts: "{{ hostname }}"

   gather_facts: false

 

 

  tasks:

    - include_role:

        name: abcservice

        tasks_from: healthchecknew.yml

      with_items:

           - "{{ group_names | first }}"

      

 

 

Role:

 

- name: clientCode:"{{ group_names | first  }}

  win_service:

    name: "{{ item }}"

  register: monitor_service

  with_items: "{{ Services 
|sort(attribute='Priority')|selectattr('Type','in','MasterMiddleTier.MiddleTier')|map(attribute='ServiceName')|list
 
}}"

 

- name: clientCode:"{{ group_names | first  }}

  win_shell: "{{ item.path.split('\\bin')[0] }}\\bin\\monitor.bat"

  ignore_errors: True

  with_items: "{{ monitor_service.results }}"

  register: monitor_output

 

- debug: msg= "{{ item.stdout }}"

  with_items: "{{ monitor_output.results}}"


ansible output

 

ok: [RPC-12.robo.local] => (item={'_ansible_parsed': True, 'stderr_lines': 
[], '_ansible_item_result': True, u'end': u'2018-12-01 09:59:03.459885', 
'_ansible_no_log': False, u'stdout': u'WARN: Alerts: 2018-11-24 06:30:43: 
Database connectivity issue detected: Network error IOException: Connection 
timed out: connect\r\n2018-11-21 11:42:50: Waiting for SONIC Messaging 
Server...\r\n\r\n', 'item': {u'username': u'LocalSystem', 
'_ansible_parsed': True, '_ansible_item_result': True, u'display_name': 
u'S02', u'desktop_interact': False, u'exists': True, 'item': u'02', 
u'start_mode': u'auto', u'changed': False, u'depended_by': [], u'name': 
u'S02', '_ansible_no_log': False, 'failed': False, u'state': u'running', 
u'dependencies': [], '_ansible_item_label': u'S02', 
u'can_pause_and_continue': False, u'path': 
u'D:\\APP\\serverapp02\\bin\\MiddleTierWindowsService.exe //RS//S02', 
'_ansible_ignore_errors': None, u'description': u'Charles River Middle 
Tier'}, u'cmd': u'D:\\APP\\serverapp02\\bin\\monitor.bat', u'rc': 1, 
u'failed': True, u'delta': u'0:00:04.224242', u'stderr': u'', u'changed': 
True, u'msg': u'non-zero return code', 'stdout_lines': [u'WARN: Alerts: 
2018-11-24 06:30:43: Database connectivity issue detected: Network error 
IOException: Connection timed out: connect', u'2018-11-21 11:42:50: Waiting 
for SONIC Messaging Server...', u''], u'start': u'2018-12-01 
09:58:59.235643', '_ansible_item_label': {u'username': u'LocalSystem', 
'_ansible_parsed': True, '_ansible_item_result': True, u'display_name': 
u'S02', u'desktop_interact': False, u'exists': True, 'item': u'S02', 
u'start_mode': u'auto', u'changed': False, u'depended_by': [], u'name': 
u'S02', '_ansible_no_log': False, 'failed': False, u'state': u'running', 
u'dependencies': [], '_ansible_item_label': u'S02', 
u'can_pause_and_continue': False, u'path': 
u'D:\\APP\\serverapp02\\bin\\MiddleTierWindowsService.exe //RS//S02', 
'_ansible_ignore_errors': None, u'description': u'Middle Tier'}}) => {

    "msg": ""

}


PLAY RECAP 
*****************************************************************************************

RPC-CECU11.crdrs.local     : ok=3    changed=1    unreachable=0    failed=0

RPC-CECU12.crdrs.local     : ok=3    changed=1    unreachable=0    failed=0





-- 
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/d0cf86d2-4f60-44e9-bc70-20c7b999c166%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to