# Getting Past Ansible Password Required Issues

DevFeed: [Getting Past Ansible Password Required Issues](<https://devfeed.tech/articles/getting-past-ansible-password-required-issues-28121.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/ansible/2020/06/03/getting-past-ansible-password-required-issues.html>)

Author: Fuzzygroup

Published: 2020-06-03T00:00:00Z

Content type: tutorial

Language: en

Sources: [Scott Johnson](<https://devfeed.tech/sources/scott-johnson.md>)

Topics: [Ansible](<https://devfeed.tech/topics/ansible.md>), [passwords](<https://devfeed.tech/topics/passwords.md>), [account](<https://devfeed.tech/topics/account.md>)

Tags: [account](<https://devfeed.tech/tags/account.md>), [ansible](<https://devfeed.tech/tags/ansible.md>), [apt](<https://devfeed.tech/tags/apt.md>), [command](<https://devfeed.tech/tags/command.md>), [exploits](<https://devfeed.tech/tags/exploits.md>), [localhost](<https://devfeed.tech/tags/localhost.md>), [module](<https://devfeed.tech/tags/module.md>), [password](<https://devfeed.tech/tags/password.md>)

## AI overview

This tutorial explains how to resolve Ansible's "sudo: a password is required" failure when running tasks after switching into the jenkins account. The author attributes the problem to Ansible's become operation and describes temporarily granting passwordless sudo access through visudo, then removing the account entry afterward.

## Source excerpt

I recently had the situation where I needed to run an Ansible task on a user which I sudo su'd into i.e.: sudo su jenkins I then ran my Ansible task and I repeatedly got this error: TASK [zzet.rbenv : update apt cache] **************************************************************************************************************** fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "sudo: a password is required\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1} The underlying issue was that most of the tasks in the playbook used: become: true which says to Ansible "run this as a sudo operation" and, given that I was already sudo'd into this account, that proved to be a failure. I puzzled over this for a bit and then realized that all I needed to do was grant the jenkins account passwordless sudo access via the command: sudo visudo by adding this line to the end of the sudoers file that visudo edits: jenkins ALL=(ALL) NOPASSWD:ALL Note: I made sure to remove the jenkins account from visudo after this was done to prevent any issues related to sudo exploits and this user.