# unable to update sudoers file on RH6u5 with validate option.

**URL:** <https://forum.ansible.com/t/unable-to-update-sudoers-file-on-rh6u5-with-validate-option/15761>\
**Category:** Ansible Project\
**Created:** [July 24, 2014, 1:05pm UTC](https://forum.ansible.com/t/unable-to-update-sudoers-file-on-rh6u5-with-validate-option/15761 "2014-07-24T13:05:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yasir\_Saleem](https://avatars.discourse-cdn.com/v4/letter/y/13edae/32.png) [@Yasir\_Saleem](https://forum.ansible.com/u/Yasir_Saleem)\
**Post date:** [July 24, 2014, 1:05pm UTC](https://forum.ansible.com/t/unable-to-update-sudoers-file-on-rh6u5-with-validate-option/15761/1 "2014-07-24T13:05:59Z")

</div>

Hi,  
I am not able to change ‘/etc/sudoers’ file successfully on RH 6.5 (Santiago) when using validate option. The same thing works fine on RH6u4 sever.

Below is my playbook and response from the server.

Note: When I run the commented ‘lineinfile’ task works fine on RH6u5 as well but I want to validate before changing ‘sudoers’ file.

- hosts: proxy  
gather\_facts: yes  
remote\_user: “{{ ssh\_remote\_user }}”  
sudo: yes  
tasks:

- name: update sudoer file to allow ADMIN nopasswd  
lineinfile: dest=/etc/sudoers state=present regexp=‘^%admin ALL =’ line=‘%admin ALL=(ALL) NOPASSWD:ALL’ validate=‘visudo -cf %s’  
#lineinfile: dest=/etc/sudoers state=present regexp=‘^%admin ALL =’ line=‘%admin ALL=(ALL) NOPASSWD:ALL’

TASK: [update sudoer file to allow ADMIN nopasswd] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
failed: [proxy10-qa1] =\> {“cmd”: “visudo -cf /tmp/tmp8UPaDy”, “failed”: true, “rc”: 2}  
msg: [Errno 2] No such file or directory

FATAL: all hosts have already failed – aborting

Thanks,  
Yasir.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [July 24, 2014, 10:42pm UTC](https://forum.ansible.com/t/unable-to-update-sudoers-file-on-rh6u5-with-validate-option/15761/2 "2014-07-24T22:42:12Z")

</div>

Hmmmm.

No such file or directory _MIGHT_ be referring to visudo. Can you try explicitly pathing it?

---

<div class="post-metadata">

**Author:** ![Yasir\_Saleem](https://avatars.discourse-cdn.com/v4/letter/y/13edae/32.png) [@Yasir\_Saleem](https://forum.ansible.com/u/Yasir_Saleem)\
**Post date:** [July 25, 2014, 1:17pm UTC](https://forum.ansible.com/t/unable-to-update-sudoers-file-on-rh6u5-with-validate-option/15761/3 "2014-07-25T13:17:00Z")

</div>

Mike,

I am sorry, I was able to fix the problem by specify full path for visudo command. It was in ‘/usr/sbin/visudo’

Validate part looks like below:

validate=‘/usr/sbin/visudo -cf %s’

For my RH6U5 boxes root does not have /usr/sbin in the path.

I could have replied earlier, When I tried to reply yesterday I was not able to access the group…

Thanks,

Yasir.
