Ansible ad hoc commands are one-liners designed to achieve a very specific task they are like quick snippets and your compact swiss army knife when you want to do a quick task across multiple machines.
To put simply, Ansible ad hoc commands are one-liner Linux shell commands and playbooks are like a shell script, a collective of many commands with logic.
Ansible ad hoc commands come handy when you want to perform a quick task.
-
write an ansible ad hoc ping command to ping 3 servers from inventory file
-
Write an ansible ad hoc command to check uptime
-
You can refer to this blog to understand the different examples of ad-hoc commands and try out them, post the screenshots in a blog with an explanation.
happy Learning :)