The command modules
Ansible has four modules that fall in to this category and provide us the options to choose from while running system commands or scripts. The four modules are:
- Raw
- Command
- Shell
- Script
We will start learning about these one at a time.
Using the raw module
Most Ansible modules require Python to be present on the target node. However, as the name suggests, a raw module provides a way to communicate with hosts over SSH to execute raw commands without getting Python involved. The use of this module will bypass the module subsystem of Ansible completely. This can come in really handy in certain special situations or cases. For example:
- For legacy systems running a Python version older than 2.6, Ansible requires the
Python-simplejson
package to be installed before you run playbooks. A raw module can be used to connect to the target host and install the prerequisite package before executing any Ansible code. - In the case of network devices, such as routers, switches, and other embedded...