- hosts: prgmr tasks: - name: setup sudo apt: pkg=sudo state=latest - name: add users to sudo group user: name={{ item }} append=yes groups=sudo state=present with_items: - alpha - name: copy sudoers file command: cp -f /etc/sudoers /tmp/sudoers - name: backup sudoers file command: cp -f /tmp/sudoers /tmp/sudoers.bak - name: don't require a password for sudo group in /tmp/sudoers lineinfile: "dest=/tmp/sudoers state=present regexp='^%sudo' line='%sudo ALL=(ALL:ALL) NOPASSWD: ALL'" - name: check /tmp/sudoers and update /etc/sudoers shell: visudo -qcf /tmp/sudoers && cp -f /tmp/sudoers /etc/sudoers