name: sudo
state: latest
update_cache: yes
+ when: ansible_facts.os_family == 'Debian'
- name: Add user phd to group sudo
become: true
name: phd
append: yes
groups: sudo
+ when: ansible_facts.os_family == 'Debian'
- name: Allow passwordless operations for phd
become: true
content: 'phd ALL=(ALL:ALL) NOPASSWD: ALL'
dest: /etc/sudoers.d/phd
owner: root
- group: sudo
+ group: "{% if ansible_facts.os_family == 'Debian' %}sudo{% elif ansible_facts.os_family == 'RedHat' %}root{% endif %}"
mode: 0640