Running Ansible ping and getting error: Operation not permitted\r\n",

When I am running a ansible ping from a ubuntu VM to a host using the command

ansible -m ping juniper

It gives me the error message …

WARNING]: Platform freebsd on host 172.16.203.122 is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change this. See https://docs.ansible.com/ansible/2.9/ reference_appendices/interpreter_discovery.html for more information.

172.16.203.122 | FAILED! => { “ansible_facts”: { “discovered_interpreter_python”: “/usr/bin/python” }, “changed”: false, “module_stderr”: “Shared connection to 172.16.203.122 closed.\r\n”, “module_stdout”: “/bin/sh: /usr/bin/python: Operation not permitted\r\n”, “msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”, “rc”: 126

My hosts file has the following entry …

[juniper]

172.16.203.122 ansible_ssh_user=root ansible_ssh_pass=my password

What is missing as i am running out of ideas

You need to deploy ssh private key for the user you are running on control node, and ssh public key for the same user on managed node, and escalated privileges, for example, sudo for that same user for commands that require escalated privileges (like reboot).

  • Xinhuan