Does Ansible shell module need python on target server?

I have a very basic playbook that simply runs a script using the shell module on the target remote host.

In the output it however fails stating python interpreter not found.

Installing python on each target is not the solution I can pursue.

Is it possible to use my Ansible automation to run the playbook and execute the script using shell module without having python dependency?


Solution 1:

Any ansible operation requires python on the target node except the raw and script modules.

Please note that these two modules are primarily meant to install ansible requirements (i.e. Python and its mandatory modules) on targets where they are missing.

In other words, Python is definitely a requirement to run ansible following all best practices (e.g. using modules when they exists, creating idempotent tasks...). If installing Python on your targets is not an option, don't use ansible, choose an other tool.

References:

  • Ansible managed node requirements
  • raw module
  • script module

Solution 2:

If you don't have Python installed and don't want to, you can take a look at Ansible raw module.