---
- name: Ubiquiti APT key
  notify: update apt cache
  apt_key:
    id: 06E85760C0A52C50
    keyserver: keyserver.ubuntu.com

- name: Ubiquiti APT repository
  notify: update apt cache
  copy:
    dest: /etc/apt/sources.list.d/unifi.list
    content: 'deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti'

- meta: flush_handlers

- name: packages
  apt:
    name: "{{ items }}"
    install_recommends: no
  vars:
    items:
      - openjdk-8-jre
      - unifi