In the previous chapter, we used the ansible webservers -i cobbler.py -m ping command to test connectivity to all of the servers in the webservers group of our dynamic inventory. This type of Ansible command is known as an ad hoc command, and it is typically used to run a single Ansible module against an inventory, with a set of parameters.
Throughout this book, we have encouraged the use of full playbooks and roles for all Ansible tasks—and for good reason! If you frequently run commands without storing the code in some shape or form, it will soon become very difficult, if not impossible, to know who ran what and when they ran it. Indeed, if you have looked into AWX/Ansible Tower, you will see that it does not even support ad hoc Ansible commands—running them is not aligned with the principles of auditability and role-based access...