Hi All,

  I have a play book, i need a help on how to display no of failed and 
successfull task as the out always , 

PLAY RECAP 
*************************************************************************************************************************************************************
server1              : ok=5    changed=0    unreachable=0    failed=0
server2              : ok=5    changed=0    unreachable=0    failed=0

*Example:*
PLAY RECAP 
*************************************************************************************************************************************************************
server1              : ok=5    changed=0    unreachable=0    failed=0    
 task_succeed=4     task_failed=1
server2              : ok=5    changed=0    unreachable=0    failed=0    
 task_succeed=3     task_failed=2

Tired the set as per the link 
"https://stackoverflow.com/questions/49805434/ansible-increment-count-in-play-recap-for-failed-tasks-when-using-ignore-errors";
 
but no luck.

- hosts: all
  become: true
  become_method: sudo
  gather_facts: no
  vars:
    failed_count: 0
  vars_files:
  - "/home/ansible/.ansible/target.yml"
  tasks:
  - name: Check the status of Kerbros Service
    shell: /bin/systemctl status {{ item.tname }} | /usr/bin/head -1
    with_items:
      - { tname: 'rpc-gssd.service' }
      - { tname: 'rpc-svcgssd.service' }
      - { tname: 'nfs-idmapd' }
    register: kerbros_status
    failed_when: kerbros_status.rc != 3
    changed_when: false
    ignore_errors: True
    tags: kerbros
  - name: Increment variable
    set_fact: failed_count={{ failed_count | int + 1 }}
    when: kerbros_status.failed


From,
Vino.B

-- 
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/b144fa88-e0ce-4b7a-aab0-7d0f898f6147%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to