disable_sudo_password.yml 311 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
---
# To be run using the following command:
# ansible-playbook -i my-inventory disable_sudo_password.yml -b -K
- hosts: all

  tasks:

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