Executing Commands on the Target Node

Using an Ansible module to execute a task is always a good idea, but sometimes, there isn’t any Ansible module for our use case. In such a case, the command and shell Ansible modules can be utilized to execute commands directly on the target nodes. However, it’s essential to note that relying on these modules for command execution is considered a suboptimal solution. This is because the command and shell modules effectively run terminal commands on the remote nodes, which may not be as idempotent, robust, or platform-independent as using dedicated Ansible modules.

Get hands-on with 1200+ tech skills courses.