- name: Install packages
  package:
    name:
      - webcamd
      - v4l-utils # Needed for support in browsers
      - v4l_compat # Needed for support in browsers
    state: present

- name: Install packages
  when: install_graphics
  package:
    name:
      - pwcview # For testing webcam
    state: present

- name: Install loader.conf
  copy:
    src: "files/{{ item }}_loader.conf"
    dest: "/boot/loader.conf.d/{{ item }}.conf"
    mode: 0644
    owner: root
    group: wheel
  loop:
    - cuse

- name: Install service configuration
  copy:
    src: "files/{{ item }}_rc.conf"
    dest: "/etc/rc.conf.d/{{ item }}"
    mode: 0644
    owner: root
    group: wheel
  loop:
    - webcamd
