How Do You Troubleshoot This Ansible Message “module_stderr…Shared connection to server closed. [Errno 13] Permission denied…MODULE FAILURE”?

Problem scenario
You try to run an Ansible playbook, but you get this problem:

"module_stderr…Shared connection to server closed. [Errno 13] Permission denied…MODULE FAILURE"

How do you fix it?

Solution
Is the Ansible playbook configuring the mode settings to not allow other users to execute the file? It could be that lower in the Ansible playbook, after the file is protected from other users executing it, the Ansible playbook is attempting to modify it. One solution would be to rearrange your playbook or eliminate the "mode: 644" settings. (Ironically the file may have the equivalent of 644 permissions settings by default if you comment out such a "mode" stanza; the error may also go away too.) Another solution would be to change the file permissions settings to something that will allow the user who is running the playbook to write to the file.

Leave a comment

Your email address will not be published. Required fields are marked *