Skip to content

Commit 45845e7

Browse files
committed
import to git
1 parent 821f696 commit 45845e7

File tree

6 files changed

+95
-0
lines changed

6 files changed

+95
-0
lines changed

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.retry
2+
/.idea

Diff for: Vagrantfile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
Vagrant.configure("2") do |config|
5+
config.vm.box = "debian/stretch64"
6+
7+
config.ssh.shell="bash"
8+
9+
config.vm.network "public_network"
10+
# To remember which network to bridge against use the line bellow instead of the one above
11+
#config.vm.network "public_network", bridge: "en0: Wi-Fi (AirPort)"
12+
13+
config.vm.provider "virtualbox" do |vb|
14+
vb.gui = false
15+
vb.memory = "1024"
16+
end
17+
18+
config.vm.provision "ansible" do |ansible|
19+
ansible.playbook = "provision.yml"
20+
end
21+
22+
config.trigger.after [:up, :reload] do |trigger|
23+
trigger.info = "Unifi Info"
24+
trigger.run_remote = {path: "start.sh"}
25+
end
26+
27+
end

Diff for: provision.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
- hosts: all
3+
become: true
4+
roles:
5+
- setup
6+
- unifi
7+
vars:
8+
- host_name: unifi
9+
10+
11+
12+
13+
14+

Diff for: roles/setup/tasks/main.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
- name: Setup - update apt
2+
apt:
3+
update_cache: yes
4+
cache_valid_time: 3600
5+
6+
- name: Setup - upgrade apt
7+
apt:
8+
cache_valid_time: 3600
9+
upgrade: yes
10+
11+
- name: "Setup - ansible requirements - {{ item }}"
12+
apt:
13+
pkg: "{{ item }}"
14+
state: latest
15+
cache_valid_time: 3600
16+
with_items:
17+
- aptitude
18+
- python-mysqldb
19+
- python-pycurl
20+
- debconf-utils
21+
22+
- name: Setup - change hostname
23+
hostname:
24+
name: "{{ host_name }}"
25+
26+
- name: Setup - add new hostname in /etc/hosts
27+
lineinfile:
28+
dest: /etc/hosts
29+
regexp: '^127\.0\.0\.1'
30+
line: "127.0.0.1 localhost {{ host_name }}"

Diff for: roles/unifi/tasks/main.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
- name: Unifi - Add repo key
2+
apt_key:
3+
id: 06E85760C0A52C50
4+
url: https://dl.ubnt.com/unifi/unifi-repo.gpg
5+
keyring: /etc/apt/trusted.gpg.d/unifi-repo.gpg
6+
7+
- name: Unifi - Add repo
8+
apt_repository:
9+
repo: deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti
10+
state: present
11+
update_cache: yes
12+
13+
- name: Unifi - Install unifi
14+
apt:
15+
name: unifi
16+
cache_valid_time: 3600

Diff for: start.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
echo "Unifi Controller v`cat /var/lib/unifi/db/version` is now listening at:"
3+
for i in `hostname --all-ip-addresses`
4+
do
5+
echo "https://$i:8443"
6+
done

0 commit comments

Comments
 (0)