Difference between revisions of "Enable passwordless sudo for a specific user"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
Line 13: Line 13:
 
         state: present
 
         state: present
 
         regexp: '^%sudo'
 
         regexp: '^%sudo'
         line: '%sudo ALL=(ALL) NOPASSWD: ALL'
+
         line: '%sudo ALL=(ALL) [[NOPASSWD]]: ALL'
 
         validate: '[[visudo]] -cf %s'
 
         validate: '[[visudo]] -cf %s'
 
  
 
== Activities ==
 
== Activities ==

Revision as of 11:52, 25 October 2020



Passwordless sudo using Ansible

#!/usr/bin/env ansible-playbook

- hosts: YOUR_MACHINE
  tasks:
    - lineinfile:
        path: /etc/sudoers
        state: present
        regexp: '^%sudo'
        line: '%sudo ALL=(ALL) NOPASSWD: ALL'
        validate: 'visudo -cf %s'

Activities

See also

Advertising: