top of page
Writer's pictureSiddhesh Kadam

Understand Ansible Play Recap

The "PLAY RECAP" section in Ansible's output provides a summary of the status of each host that was targeted during a playbook run. It's a concise overview of how the tasks within the playbook impacted each host. The "PLAY RECAP" section is especially useful for quickly assessing the success or failure of the playbook run.


Here's a breakdown of the information typically included in the "PLAY RECAP" section:


Hostname: This is the name or IP address of the target host.


Success Count (ok=): The number of tasks that executed successfully on the host. This indicates that the tasks ran without errors and achieved the expected result.


Changed Count (changed=): The number of tasks that caused changes on the host. A "changed" status means that the task made modifications to the system, such as installing packages or updating configurations.


Unreachable Count (unreachable=): The number of hosts that Ansible couldn't reach or connect to during the playbook run. This typically occurs due to network issues, host unavailability, or incorrect SSH settings.


Failed Count (failed=): The number of tasks that failed to execute on the host. This indicates that an error occurred during task execution.


Skipped Count (skipped=): The number of tasks that were skipped. Tasks might be skipped if a condition isn't met or if the playbook logic dictates that the task should not run on a particular host.


Rescued Count (rescued=): The number of tasks that were rescued. This occurs when a task initially fails but is later rescued by a "rescue" or "ignore_errors" directive in the playbook.


Ignored Count (ignored=): The number of tasks that were explicitly ignored in the playbook.


The "PLAY RECAP" section is an efficient way to quickly assess the overall success of your playbook run and identify which hosts were affected, whether they were updated, and whether any issues occurred. It helps you pinpoint hosts that need further attention and investigation if they had errors or changes that were not expected. Here's an example of a "PLAY RECAP" section:

PLAY RECAP *****************************************************************************
jenkins.builddevops.com                : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
mysql.builddevops.com                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
nginx.builddevops.com                  : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
[root@siddhesh ~]#

In this example:


All tasks were successful (ok=2) on all three hosts.

Tasks caused changes (changed=1) on two of the hosts (jenkins.builddevops.com and mysql.builddevops.com).

There were no unreachable, failed, skipped, rescued, or ignored tasks for any of the hosts.





bottom of page