0

my client machine is 5.11 and python version 2.7 but still it is failing

root@00047BLRSANDEEPC:/mnt/e/Ansible-project/Solarwind/systems_swiagent_install/tests# ansible -i hosts all -m shell -a "cat /etc/redhat-release"
10.XX.XX.XX | FAILED! => {
    "changed": false,
    "module_stderr": "Shared connection to 10.XX.XX.XX closed.\r\n",
    "module_stdout": "  File \"/root/.ansible/tmp/ansible-tmp-1561087764.46-1054359176771/AnsiballZ_command.py\", line 39\r\n    with open(module, 'wb') as f:\r\n            ^\r\nSyntaxError: invalid syntax\r\n",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

Working -->

root@00047BLRSANDEEPC:/mnt/e/Ansible-project/Solarwind/systems_swiagent_install/tests# ansible -i hosts all -m raw -a "cat /etc/redhat-release"
10.XX.XX.XX | CHANGED | rc=0 >>
CentOS release 5.11 (Final)
Shared connection to 10.XX.XX.XX closed.
error404
  • 2,684
  • 2
  • 13
  • 21

1 Answers1

0

Raw module dont need python to be installed. Hence it is giving required output.
While running shell command, it is unable to detect python on that remote host. Try to set python executable in PATH variable. ansible -i hosts all -m shell -a "export PATH=< python_installed_location>:$PATH && cat /etc/redhat-release"

If this works, try to set python in PATH variable and then run all commands.

Ravi Kulkarni
  • 527
  • 1
  • 7
  • 12