# Getting failed to execute: ansible.legacy.setup

**URL:** <https://forum.ansible.com/t/getting-failed-to-execute-ansible-legacy-setup/35291>\
**Category:** Ansible Project\
**Tags:** rhel\
**Created:** [June 5, 2021, 4:36pm UTC](https://forum.ansible.com/t/getting-failed-to-execute-ansible-legacy-setup/35291 "2021-06-05T16:36:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![foramgoram123](https://avatars.discourse-cdn.com/v4/letter/f/b487fb/32.png) [@foramgoram123](https://forum.ansible.com/u/foramgoram123)\
**Post date:** [June 5, 2021, 4:36pm UTC](https://forum.ansible.com/t/getting-failed-to-execute-ansible-legacy-setup/35291/1 "2021-06-05T16:36:03Z")

</div>

Running ansible version 2.10.4 with Python 3.6.8 gives the following error:

fatal: [server001.example.ca]: FAILED! =\> {“ansible\_facts”: {}, “changed”: false, “failed\_modules”: {“ansible.legacy.setup”: {“ansible\_facts”: {“discovered\_interpreter\_python”: “/usr/bin/python”}, “failed”: true, “module\_stderr”: “Shared connection to server001.example.ca closed.\r\n”, “module\_stdout”: “\r\nMOTD Message\r\n\r\n\r\n”, “msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”, “rc”: 1}}, “msg”: “The following modules failed to execute: ansible.legacy.setup\n”}

The target server is RHEL 7.9 with with python 2.7.

Please help.

---

<div class="post-metadata">

**Author:** ![foramgoram123](https://avatars.discourse-cdn.com/v4/letter/f/b487fb/32.png) [@foramgoram123](https://forum.ansible.com/u/foramgoram123)\
**Post date:** [June 6, 2021, 2:34pm UTC](https://forum.ansible.com/t/getting-failed-to-execute-ansible-legacy-setup/35291/2 "2021-06-06T14:34:12Z")

</div>

For anyone having this issue, here is the solution.  
The reason it was throwing that error was that the target server was using dzdo instead of sudo. Changing  
become\_method = su to become\_method = dzdo in ansible.cfg fixed the issue.
