Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Installs Ubiquiti UniFi Controller on Raspian (Raspberry Pi 2/3)
# adapted from: https://loganmarchione.com/2016/11/ubiquiti-unifi-controller-setup-raspberry-pi-3/
---
- hosts: newpi
become: true
tasks:
- name: Add apt key for unifi repository
apt_key:
keyserver: keyserver.ubuntu.com
id: C0A52C50
- name: Add unifi repository
apt_repository:
repo: deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti
state: present
filename: unifi
- name: Update apt cache and install unifi and java packages
apt:
name: "{{ item }}"
state: latest
update_cache: yes
cache_valid_time: 3600
with_items:
- unifi
- oracle-java8-jdk
- name: Switch to Oracle Java 8
alternatives:
name: java
path: /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/java
- name: Copy unifi.service to /etc/systemd/system
command: cp -p /lib/systemd/system/unifi.service /etc/systemd/system
- name: Add JAVA_HOME to unifi.service
lineinfile:
path: /etc/systemd/system/unifi.service
insertafter: '\[Service\]'
line: "Environment=JAVA_HOME=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt"
state: present
- name: Start unifi service and enable at boot
systemd:
name: unifi
state: restarted
daemon_reload: yes
enabled: yes
- name: Disable mongodb as unifi will run its own instance
systemd:
name: mongodb
state: stopped
enabled: no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.