1

I have a playbook that runs with no errors in my local tests VM (CentOS7) but when I run this same playbook on the prod servers (RHEL7).

I run below command

sudo ansible-playbook passwords.yml -e 

and I keep getting the below error:

'ansible_python_interpreter=/usr/bin/python3' -i irm-inventory -bK
 BECOME password: 
PLAY [Adjust password settings] ******************************************************************************************************************
 TASK [Gathering Facts] ***************************************************************************************************************************
 fatal: [SERVERNAME]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"setup": {"failed": true, "module_stderr":
"Shared connection to SERVER_IP closed.\r\n", "module_stdout": "\r\n",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc":
1}}, "msg": "The following modules failed to execute: setup\n"}
**************************************************************************************************************************************
SERVERNAME                 : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

What are possible causes for this issue? I already tried with python2 and python3

3
  • Make sure you are on Ansible 2.9, upgrade if you are not, and then remove the explicit setting for the Python interpreter. Feb 25, 2021 at 23:07
  • Hi, thanks for answering, in this controller machine I do have ansible 2.8.17. A particularity is that if I try to run ansible without sudo I get an error: IOError: [Errno 13] Permission denied: '/usr/lib64/python2.7/site-packages/cryptography-2.1.2.dist-info/METADATA'
    – brunofl
    Feb 26, 2021 at 12:10
  • OK, so update to 2.9: subscription-manager repos --enable rhel-7-server-ansible-2.9-rpms, or better, use rhel-7-server-ansible-2-rpms so you will always be on the latest version. Feb 26, 2021 at 14:25

1 Answer 1

0

You call ansible-playbook with the -bK parameters: ask for privilege escalation password & run operations with become. This is usually fine, but might cause the problem.

I suggest to try without -bK first. If it works then your playbook doesn't need the become. If it dies with a task-specific error, then attempt a different become_method:

(at play or task level) overrides the default method set in ansible.cfg, set to sudo/su/pbrun/pfexec/doas/dzdo/ksu

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .