Ansible playbook/commands fails with an error: 'Shared connection to host closed' when privilege escalation is active.
Issue
- How to manage sudo access for non-root user on ansible managed node?
- Ansible ad-hoc commands encounter a 'Shared connection to host closed' error when privilege escalation is enabled using
become.
[root@examplehost ansible]# ansible all -i inventory -m shell -a 'id' -b
10.0.0.1 | FAILED! => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/libexec/platform-python"
},
"changed": false,
"module_stderr": "Shared connection to 10.0.0.1 closed.\r\n",
"module_stdout": "\r\n",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
Environment
- Red Hat Enterprise Linux
- Ansible
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.