Configuration Management Tool

An exception occurred during task execution: AttributeError ‘ShellModule’ object has no attribute ‘ECHO’ fatal – FAILED! Unexpected failure during module execution, stdout

Ansible will throw this error when you are trying to display the stdout (or) stderr of a task during playbook runtime. This error is a result of the playbook configured to use “become”. And have not been properly configured “become_method: runas” for a windows target, and as such it is attempting to use the sudo become plugin. Here are some related contents: How to view installed packages in Cygwin in Windows, how to configure Kerberos for Ansible Authentication, and how to determine Cygwin version.

TASK [Gathering Facts] ****
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'ShellModule' object has no attribute 'ECHO'
fatal: [192.168.178.43]: FAILED! => {"msg": "Unexpected failure during module execution.", "stdout": ""}

Solution: Set “ansible_become_method: runas” in your Ansible inventory file. Otherwise, it is trying to use sudo (the default) on a Windows machine, which will not work.

ansible_become_method: runas

– Adjust the inventory file. Therefore, setting become_method to runas, which is the only method supported by Windows.

To view full traceback, use the command below (where createfile.ym will be replaced by your playbook). For more information, PLEASE review this link

- ansible-playbook -b -vvv createfile.yml

Where the following parameters are explained below
-b: run operations with become (same as —become).
-vvv: verbose mode (-vvv for more, -vvvv to enable connection debugging).

I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x