--- - name: Ensure sudo is installed apt: name={{ item }} install_recommends=no with_items: - sudo - name: Disable password based sudo for users in group sudo and enable password less sudo lineinfile: dest: "/etc/sudoers" regexp: '^%sudo' line: "%sudo ALL=(ALL:ALL) NOPASSWD: ALL" validate: 'visudo -cf %s'