---
- name: Install CUPS and drivers
  pacman:
    name:
      - ghostscript
      - gsfonts
      - cups
      - cups-pdf
      - gutenprint
      - hplip
      - gtk3-print-backends
    state: present

- name: Add a print admin group
  group: name=printadmin state=present

- name: Allow the print admin group to administer CUPS
  lineinfile: dest=/etc/cups/cups-files.conf
              regexp=^SystemGroup
              state=present
              line="SystemGroup sys root printadmin"
  notify:
    - restart cups

- name: Add the user to the print and print admin groups
  user: name={{ user.name }} groups=printadmin,lp append=yes
  tags:
    - user

- name: Enable and start CUPS
  service: name=org.cups.cupsd.service enabled=yes state=started
