Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 600
Ashar Avatar asked Jul 03 '20 11:07

Ashar


People also ask

Does Ansible require Python on target?

By default Ansible modules require python to be present in the target machines, since they are all written in python.

What are the requirements of the Ansible server Python?

Control Machine Requirements Currently Ansible can be run from any machine with Python 2 (version 2.7) or Python 3 (versions 3.5 and higher) installed. Windows isn't supported for the control machine. This includes Red Hat, Debian, CentOS, macOS, any of the BSDs, and so on.

Does Ansible need Python on Windows?

Most of the Ansible modules in Ansible Core are written for a combination of Linux/Unix machines and arbitrary web services. These modules are written in Python and most of them do not work on Windows.


1 Answers

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
like image 92
Zeitounator Avatar answered Nov 11 '22 05:11

Zeitounator