As we discussed earlier in this chapter, Ansible modules return their results as structured data, formatted behind the scenes in JSON. You came across this return data in the previous example, both in the form of exit code and where we used the register keyword to capture the results of a task in an Ansible variable. In this section, we shall explore how to discover the return values for an Ansible module so that we can work with them later on in a playbook, for example, with conditional processing (see Chapter 4, Playbooks and Roles).
Due to conserving space, we shall choose what is perhaps one of the simplest Ansible modules to work with when it comes to return values – the ping module.
Without further ado, let's use the ansible-doc tool that we learned about in the previous section and see what this says about the return values for this module...