Last active
November 20, 2017 23:04
-
-
Save syntaxerrormmm/031d705441877f225af42c491ee47f6d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Unifi Controller on NethServer 7 | |
# Instruction taken and adapted from: | |
# https://community.nethserver.org/t/howto-install-unifi-controller-on-a-nethserver/4779 | |
- name: Installing dependencies | |
yum: | |
name: "{{ item }}" | |
state: present | |
with_items: | |
- mongodb | |
- mongodb-server | |
- unzip | |
- java | |
- name: Configuring mongodb startup | |
service: | |
name: mongod | |
state: started | |
enabled: yes | |
- name: Defaults for mongodb - folder | |
file: | |
name: /etc/e-smith/db/configuration/defaults/mongod | |
state: directory | |
owner: root | |
group: root | |
mode: 755 | |
- name: defaults - mongodb property status | |
lineinfile: | |
dest: /etc/e-smith/db/configuration/defaults/mongod/status | |
state: present | |
line: "enabled" | |
owner: root | |
group: root | |
mode: 0644 | |
create: yes | |
- name: defaults - mongodb property type | |
lineinfile: | |
dest: /etc/e-smith/db/configuration/defaults/mongod/type | |
state: present | |
line: "service" | |
owner: root | |
group: root | |
mode: 0644 | |
create: yes | |
- name: config mongodb | |
shell: /sbin/e-smith/db configuration set mongod service status enabled | |
notify: nethserver-add-service | |
- name: Adding GPG signature for marmotte.net | |
rpm_key: | |
key: "http://dl.marmotte.net/rpms/RPM-GPG-KEY-matthias" | |
state: present | |
- name: Check for already installed unifi-controller | |
yum: | |
name: unifi-controller | |
state: present | |
ignore_errors: yes | |
register: check_unifi | |
- name: Unofficial package installation from marmotte.net | |
yum: | |
name: "http://dl.marmotte.net/rpms/redhat/el7/x86_64/unifi-controller-5.5.24-1.el7/unifi-controller-5.5.24-1.el7.x86_64.rpm" | |
state: present | |
when: check_unifi|failed or force_unifi_upgrade == True | |
- name: systemd - daemon configuration | |
service: | |
name: unifi | |
enabled: yes | |
state: started | |
- name: defaults unifi - folder | |
file: | |
path: /etc/e-smith/db/configuration/defaults/unifi | |
state: directory | |
owner: root | |
group: root | |
mode: 0755 | |
- name: defaults - unifi property status | |
lineinfile: | |
dest: /etc/e-smith/db/configuration/defaults/unifi/status | |
state: present | |
line: "enabled" | |
owner: root | |
group: root | |
mode: 0644 | |
create: yes | |
- name: defaults - unifi property type | |
lineinfile: | |
dest: /etc/e-smith/db/configuration/defaults/unifi/type | |
state: present | |
line: "service" | |
owner: root | |
group: root | |
mode: 0644 | |
create: yes | |
- name: defaults - unifi property access | |
lineinfile: | |
dest: /etc/e-smith/db/configuration/defaults/unifi/access | |
state: present | |
line: "green" | |
owner: root | |
group: root | |
mode: 0644 | |
create: yes | |
- name: defaults - unifi property TCPPorts | |
lineinfile: | |
dest: /etc/e-smith/db/configuration/defaults/unifi/TCPPorts | |
state: present | |
line: "8080,8443,8880,8843" | |
owner: root | |
group: root | |
mode: 0644 | |
create: yes | |
- name: defaults - unifi property UDPPorts | |
lineinfile: | |
dest: /etc/e-smith/db/configuration/defaults/unifi/UDPPorts | |
state: present | |
line: "3478,10001" | |
owner: root | |
group: root | |
mode: 0644 | |
create: yes | |
- name: config unifi | |
shell: /sbin/e-smith/db configuration set unifi service status enabled access green TCPPorts 8080,8443,8880,8843 UDPPorts 3478,10001 | |
notify: nethserver-add-service | |
- name: Adding button to dashboard for Unifi Controller | |
copy: | |
src: UnifiController.php | |
dest: /usr/share/nethesis/NethServer/Module/Dashboard/Applications/UnifiController.php | |
owner: root | |
group: root | |
mode: 0644 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace NethServer\Module\Dashboard\Applications; | |
/* | |
* Copyright (C) 2013 Nethesis S.r.l. | |
* | |
* This script is part of NethServer. | |
* | |
* NethServer is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or | |
* (at your option) any later version. | |
* | |
* NethServer is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
* GNU General Public License for more details. | |
* | |
* You should have received a copy of the GNU General Public License | |
* along with NethServer. If not, see <http://www.gnu.org/licenses/>. | |
*/ | |
/** | |
* Unifi Controller | |
* | |
* @author Emiliano Vavassori (syntaxerrormmm-AT-gmail.com) | |
*/ | |
class UnifiController extends \Nethgui\Module\AbstractModule implements \NethServer\Module\Dashboard\Interfaces\ApplicationInterface | |
{ | |
public function getName() | |
{ | |
return "Unifi Controller"; | |
} | |
public function getInfo() | |
{ | |
$host = explode(':',$_SERVER['HTTP_HOST']); | |
return array( | |
'url' => "https://".$host[0].":8443" | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh, missing the handler: