---

- name: Create '{{ new_user }}' user
  user: >
    name={{ new_user }}
    createhome={{ create_home }}
    system={{ is_system_user }}
    shell={{ default_shell }}
    groups={{ secondary_groups }}

- name: Allow passwordless sudo for '{{ new_user }}' user
  lineinfile: >
    dest=/etc/sudoers
    state=present
    line="{{ new_user }} ALL=(ALL) NOPASSWD: ALL"
    insertafter="root ALL=(ALL) ALL"

---

- name: Create '{{ new_user }}' user
  user: >
    name={{ new_user }}
    createhome={{ create_home }}
    system={{ is_system_user }}
    shell={{ default_shell }}
    groups={{ secondary_groups }}

- name: Install sudo package
  pacman: >
    name=sudo
    state=present
    update_cache=yes

- name: Allow passwordless sudo for '{{ new_user }}' user
  lineinfile: >
    dest=/etc/sudoers
    state=present
    line="{{ new_user }} ALL=(ALL) NOPASSWD: ALL"
    insertafter="root ALL=(ALL) ALL"

Add missing sudo package to sudo-user playbook
fix: Add missing sudo package to sudo-user playbook

/etc/sudoers file did not exist; Ansible failed when tried to add
the NOPASSWD line
