setup module is failing

Hello,
I’ve ansible control node(CentOS 7) which is used to scp build image to target server(FreeBSD 11.04). It was just working fine last week. However, today I’d tried to run playbook, it got failed with below error message.

ansible-playbook -i zsdev-hosts Scp_build.yml --extra-vars build_version=

fatal: [zsdev-nrt-smca2]: FAILED! => {

“ansible_facts”: {},
“changed”: false,
“failed_modules”: {
“setup”: {
“failed”: true,
“module_stderr”: “Shared connection to X.X.X.X closed.\r\n”,
“module_stdout”: “sudo: (null): option "passprompt_override" does not take a value\r\r\nsudo: error initializing audit plugin sudoers_audit\r\r\n”,
“msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”,
“rc”: 1
}
},
“msg”: “The following modules failed to execute: setup\n”
}

Scp_build.yml playbook

Is the version of Python at FreeBSD supported?
https://endoflife.date/python

Try

  ansible_python_interpreter: /usr/local/bin/python3.6

Thank you Vladimir for responding.
Yes, both Python2.7 and Python 3.7 are supported by FreeBSD. I tried with ansible_python_interpreter = ‘/usr/local/bin/python3’ and encountered the same error.

fatal: [zsdev-nrt-smca2]: FAILED! => {

“ansible_facts”: {},
“changed”: false,
“failed_modules”: {
“setup”: {
“failed”: true,
“module_stderr”: “OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 58: Appl
ying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwa
rds: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done
pid = 2334\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header fa
iled: Broken pipe\r\ndebug2: Received exit status from master 1\r\nShared connection to X.X.X.X closed.\r\n”,
“module_stdout”: “sudo: (null): option "passprompt_override" does not take a value\r\r\nsudo: error initializing audit plugin sudoers_audit\r\r\n”,
“msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”,
“rc”: 1
}
},
“msg”: “The following modules failed to execute: setup\n”

Strange,
especially if it was working b4. what has changed ?
Are u able to run sudo without issues on the remote host ?
Also check your sudoers file with visudo -c (on the remote node)

This may be of interest to you: https://bugzilla.sudo.ws/show_bug.cgi?id=993

There was a bug in sudo 1.9.8 that has since been fixed.

very interesting, indeed Matt.
just checked and freebsd 11.4 ships with sudo 1.9.8 which is subject to the bug, this can be checked with sudo -p ’ ’ true
@Mohammad, I suggest you patch your sudo package to 1.9.8.p1; that will probably solve your issue.

In FreeBSD, Python 2.7 is not supported anymore but might work. I
tested old 10.3 and it is working with 2.7. The controller is CentOS
8, Ansible 2.9 and Python 3.6

$ cat /etc/redhat-release
CentOS Linux release 8.4.2105

$ ansible --version
ansible 2.9.23
...
location = /usr/bin/ansible python version = 3.6.8 (default, Mar 19
2021, 05:13:41) [GCC 8.4.1 20200928 (Red Hat 8.4.1-1)]

$ ansible host1 -m setup | grep ansible_python_version
        "ansible_python_version": "2.7.13"

From your data it's not possible to say what is the problem. To move
forward, minimize your setup and locate the problem. See
Troubleshooting Guide
https://docs.ansible.com/ansible/latest/network/user_guide/network_debug_troubleshooting.html

1) Are yo able connect to the remote host? $ ssh admin@host
2) Are you able to ping it? $ ansible host -u admin -m ping
3) Are you able to run setup? $ ansible host -u admin -m setup
4) Try with Python >= 3.6
...

Thanks again Vladimir. I’d tried following troubleshooting guide, here is the results:

Ansible Control Node

Thank you so much Vladimir, Matt and Stefi… as Matt pointed that there is bug in sudo-1.9.8. Once upgrading to sudo-1.9.8p1, issue got resolved.

Thanks again for helping me out, truly appeciated :slight_smile:

Stay safe and healthy!

I’m sharing the steps which I’d followed to troubleshoot and resolved the issue:

sudo -p ‘’ true
if not output, all good
else below output
sudo: (null): option “passprompt_override” does not take a value
sudo: error initializing audit plugin sudoers_audit

#check sudoer file parsing
visudo -c

#check sudo version
sudo -V

#backup existing sudoers file
cp /usr/local/etc/sudoers /sc/build/

#download sudo package:
cd /sc/build/ && fetch https://www.sudo.ws/dist/sudo-1.9.8p1.tar.gz
tar -xvf sudo-1.9.8p1.tar.gz && cd sudo-1.9.8p1

./configure --build=amd64-unknown-freebsd24
make
make install
cp sudoers /etc/sudoers && cp sudoers /usr/local/etc/sudoers

Hope, it’d help someone.