Discussion - Unifi Controller YAML file | PlexGuide.com

Discussion Unifi Controller YAML file

  • Stop using Chrome! Download the Brave Browser via >>> [Brave.com]
    It's a forked version of Chrome with native ad-blockers and Google's spyware stripped out! Download for Mac, Windows, Android, and Linux!
Welcome to the PlexGuide.com
Serving the Community since 2016!
Register Now

Sejrup

Experienced
Original poster
Jan 11, 2019
91
32
Hi all

In case anyone wants to try out the Unifi Controller, below yaml code might work :) (it does for me on a local dedicated server)

I have commented out intport7/extport7 because it uses the same port as nzbget. The port is used for UniFi mobile speed test, but the controller appears to be working without it. I will just change nzbget's port in case I ever need it for the Unifi controller.

Sorry for not pushing the file directly to the community repo. Haven't figured that bit out yet :giggle:

YAML:
#!/bin/bash
#
# Title:      PGBlitz (Reference Title File)
# Author(s):  Admin9705
# URL:        https://pgblitz.com - http://github.pgblitz.com
# GNU:        General Public License v3.0
################################################################################
---
- hosts: localhost
  gather_facts: false
  tasks:
    # FACTS #######################################################################
    - name: 'Set Known Facts'
      set_fact:
        pgrole: 'unifi'
        intport: '3478/udp'
        extport: '3478'
        intport2: '10001/udp'
        extport2: '10001'
        intport3: '8080/tcp'
        extport3: '8080'
        intport4: '8081/tcp'
        extport4: '8081'
        intport5: '8443/tcp'
        extport5: '8443'
        intport6: '8880/tcp'
        extport6: '8880'
#        intport7: '6789/tcp'
#        extport7: '6789'
        image: 'linuxserver/unifi:latest'

    # CORE (MANDATORY) ############################################################
    - name: 'Including cron job'
      include_tasks: '/opt/coreapps/apps/_core.yml'

    # LABELS ######################################################################
    - name: 'Adding Traefik'
      set_fact:
        pg_labels:
           traefik.enable: 'true'
           traefik.tags: 'frontend'
           traefik.frontend.passHostHeader: 'true'
           traefik.backend: '{{pgrole}}'
           traefik.admin.frontend.rule: 'Host:{{pgrole}}.{{domain.stdout}},{{tldset}}'
           traefik.admin.port: '{{intport5}}'
           traefik.admin.protocol: 'https
           traefik.frontend.headers.SSLRedirect: 'true'
           traefik.frontend.headers.STSSeconds: '315360000'
           traefik.frontend.headers.browserXSSFilter: 'true'
           traefik.frontend.headers.contentTypeNosniff: 'true'
           traefik.frontend.headers.forceSTSHeader: 'true'
           traefik.frontend.headers.SSLHost: '{{domain.stdout}}'
           traefik.frontend.headers.STSIncludeSubdomains: 'true'
           traefik.frontend.headers.STSPreload: 'true'
           traefik.frontend.headers.frameDeny: 'true'     
              
    - name: 'Setting PG Volumes'
      set_fact:
        pg_volumes:
          - '/opt/appdata/{{pgrole}}:/config'
          - '/etc/localtime:/etc/localtime:ro'

    - name: 'Setting PG ENV'
      set_fact:
        pg_env:
          PUID: '1000'
          PGID: '1000'
          TZ: '${TZ}'
          
    # MAIN DEPLOYMENT #############################################################
    - name: 'Deploying {{pgrole}}'
      docker_container:
        name: '{{pgrole}}'
        image: '{{image}}'
        pull: yes
        published_ports:
          - '{{ports.stdout}}{{extport}}:{{intport}}'
          - '{{ports.stdout}}{{extport2}}:{{intport2}}'
          - '{{ports.stdout}}{{extport3}}:{{intport3}}'
          - '{{ports.stdout}}{{extport4}}:{{intport4}}'
          - '{{ports.stdout}}{{extport5}}:{{intport5}}'
          - '{{ports.stdout}}{{extport6}}:{{intport6}}'                   
        volumes: '{{pg_volumes}}'
        env: '{{pg_env}}'
        restart_policy: always
        networks:
          - name: plexguide
            aliases:
              - '{{pgrole}}'
        state: started
        labels: '{{pg_labels}}'
 
  • Like
Reactions: 1 user
M

MrDoob

Guest
Is this line correct

Bash:
traefik.admin.protocol: 'https
I don't think so, but you must edit it to

Bash:
traefik.admin.protocol: 'https'
One >> ' << is missing in the line , please check it before you push the file
 

Sejrup

Experienced
Original poster
Jan 11, 2019
91
32
Yes correct, I will add it to above post. Thanks for pointing out :)
 
  • Like
Reactions: 1 user

Sejrup

Experienced
Original poster
Jan 11, 2019
91
32
YAML:
#!/bin/bash
#!/bin/bash
#
# Title:      PGBlitz (Reference Title File)
# Author(s):  Admin9705
# URL:        https://pgblitz.com - http://github.pgblitz.com
# GNU:        General Public License v3.0
################################################################################
---
- hosts: localhost
  gather_facts: false
  tasks:
    # FACTS #######################################################################
    - name: 'Set Known Facts'
      set_fact:
        pgrole: 'unifi'
        intport: '3478/udp'
        extport: '3478'
        intport2: '10001/udp'
        extport2: '10001'
        intport3: '8080/tcp'
        extport3: '8080'
        intport4: '8081/tcp'
        extport4: '8081'
        intport5: '8443/tcp'
        extport5: '8443'
        intport6: '8880/tcp'
        extport6: '8880'
        image: 'linuxserver/unifi-controller:LTS'

    # CORE (MANDATORY) ############################################################
    - name: 'Including cron job'
      include_tasks: '/opt/coreapps/apps/_core.yml'

    # LABELS ######################################################################
    - name: 'Adding Traefik'
      set_fact:
        pg_labels:
           traefik.enable: 'true'
           traefik.tags: 'frontend'
           traefik.frontend.passHostHeader: 'true'
           traefik.backend: '{{pgrole}}'
           traefik.admin.frontend.rule: 'Host:{{pgrole}}.{{domain.stdout}},{{tldset}}'
           traefik.admin.port: '{{intport5}}'
           traefik.admin.protocol: 'https'
           traefik.frontend.headers.SSLRedirect: 'true'
           traefik.frontend.headers.STSSeconds: '315360000'
           traefik.frontend.headers.browserXSSFilter: 'true'
           traefik.frontend.headers.contentTypeNosniff: 'true'
           traefik.frontend.headers.forceSTSHeader: 'true'
           traefik.frontend.headers.SSLHost: '{{domain.stdout}}'
           traefik.frontend.headers.STSIncludeSubdomains: 'true'
           traefik.frontend.headers.STSPreload: 'true'
           traefik.frontend.headers.frameDeny: 'true'     
              
    - name: 'Setting PG Volumes'
      set_fact:
        pg_volumes:
          - '/opt/appdata/{{pgrole}}:/config'
          - '/etc/localtime:/etc/localtime:ro'

    - name: 'Setting PG ENV'
      set_fact:
        pg_env:
          PUID: '1000'
          PGID: '1000'
          TZ: '${TZ}'
          
    # MAIN DEPLOYMENT #############################################################
    - name: 'Deploying {{pgrole}}'
      docker_container:
        name: '{{pgrole}}'
        image: '{{image}}'
        pull: yes
        published_ports:
          - '{{ports.stdout}}{{extport}}:{{intport}}'
          - '{{ports.stdout}}{{extport2}}:{{intport2}}'
          - '{{ports.stdout}}{{extport3}}:{{intport3}}'
          - '{{ports.stdout}}{{extport4}}:{{intport4}}'
          - '{{ports.stdout}}{{extport5}}:{{intport5}}'
          - '{{ports.stdout}}{{extport6}}:{{intport6}}'
        volumes: '{{pg_volumes}}'
        env: '{{pg_env}}'
        restart_policy: always
        networks:
          - name: plexguide
            aliases:
              - '{{pgrole}}'
        state: started
        labels: '{{pg_labels}}'
image updated an outcomment port removed

image updated also on the community apps

// @MrDoob @Sejrup
 
Last edited by a moderator:

Admin9705

Administrator
Project Manager
Donor
Jan 17, 2018
5,156
2,112
Hi all

In case anyone wants to try out the Unifi Controller, below yaml code might work :) (it does for me on a local dedicated server)

I have commented out intport7/extport7 because it uses the same port as nzbget. The port is used for UniFi mobile speed test, but the controller appears to be working without it. I will just change nzbget's port in case I ever need it for the Unifi controller.

Sorry for not pushing the file directly to the community repo. Haven't figured that bit out yet :giggle:

YAML:
#!/bin/bash
#
# Title:      PGBlitz (Reference Title File)
# Author(s):  Admin9705
# URL:        https://pgblitz.com - http://github.pgblitz.com
# GNU:        General Public License v3.0
################################################################################
---
- hosts: localhost
  gather_facts: false
  tasks:
    # FACTS #######################################################################
    - name: 'Set Known Facts'
      set_fact:
        pgrole: 'unifi'
        intport: '3478/udp'
        extport: '3478'
        intport2: '10001/udp'
        extport2: '10001'
        intport3: '8080/tcp'
        extport3: '8080'
        intport4: '8081/tcp'
        extport4: '8081'
        intport5: '8443/tcp'
        extport5: '8443'
        intport6: '8880/tcp'
        extport6: '8880'
#        intport7: '6789/tcp'
#        extport7: '6789'
        image: 'linuxserver/unifi:latest'

    # CORE (MANDATORY) ############################################################
    - name: 'Including cron job'
      include_tasks: '/opt/coreapps/apps/_core.yml'

    # LABELS ######################################################################
    - name: 'Adding Traefik'
      set_fact:
        pg_labels:
           traefik.enable: 'true'
           traefik.tags: 'frontend'
           traefik.frontend.passHostHeader: 'true'
           traefik.backend: '{{pgrole}}'
           traefik.admin.frontend.rule: 'Host:{{pgrole}}.{{domain.stdout}},{{tldset}}'
           traefik.admin.port: '{{intport5}}'
           traefik.admin.protocol: 'https
           traefik.frontend.headers.SSLRedirect: 'true'
           traefik.frontend.headers.STSSeconds: '315360000'
           traefik.frontend.headers.browserXSSFilter: 'true'
           traefik.frontend.headers.contentTypeNosniff: 'true'
           traefik.frontend.headers.forceSTSHeader: 'true'
           traefik.frontend.headers.SSLHost: '{{domain.stdout}}'
           traefik.frontend.headers.STSIncludeSubdomains: 'true'
           traefik.frontend.headers.STSPreload: 'true'
           traefik.frontend.headers.frameDeny: 'true'    
             
    - name: 'Setting PG Volumes'
      set_fact:
        pg_volumes:
          - '/opt/appdata/{{pgrole}}:/config'
          - '/etc/localtime:/etc/localtime:ro'

    - name: 'Setting PG ENV'
      set_fact:
        pg_env:
          PUID: '1000'
          PGID: '1000'
          TZ: '${TZ}'
         
    # MAIN DEPLOYMENT #############################################################
    - name: 'Deploying {{pgrole}}'
      docker_container:
        name: '{{pgrole}}'
        image: '{{image}}'
        pull: yes
        published_ports:
          - '{{ports.stdout}}{{extport}}:{{intport}}'
          - '{{ports.stdout}}{{extport2}}:{{intport2}}'
          - '{{ports.stdout}}{{extport3}}:{{intport3}}'
          - '{{ports.stdout}}{{extport4}}:{{intport4}}'
          - '{{ports.stdout}}{{extport5}}:{{intport5}}'
          - '{{ports.stdout}}{{extport6}}:{{intport6}}'                  
        volumes: '{{pg_volumes}}'
        env: '{{pg_env}}'
        restart_policy: always
        networks:
          - name: plexguide
            aliases:
              - '{{pgrole}}'
        state: started
        labels: '{{pg_labels}}'
thank you for helping!
 
  • Like
Reactions: 1 user

Sejrup

Experienced
Original poster
Jan 11, 2019
91
32
@Sejrup

your app is added ;) in 8.5 and 8.6 ;)
Image should probably be replaced by linuxserver/unifi-controller as linuxserver/unifi has been deprecated. Should be a 1:1 replacement though as ports and everything else remains the same
 

losjax

Citizen+
Donor
Aug 25, 2018
23
6
So I have a question. Did anyone actually get this to work? Don't get me wrong it installs and runs fine in the container, but I could never get it to adopt my devices.
 

Barrow1990

Active
Jan 22, 2019
33
2
So I have a question. Did anyone actually get this to work? Don't get me wrong it installs and runs fine in the container, but I could never get it to adopt my devices.
According to the Unifi Website 'Unifi Used Ports'
You need to open port 8080 to the world. I had it set up but was having conflicts with Sabnzbd and i have a local controller set up in a docker. Ive not got a requirement to make it external yet.
 
M

MrDoob

Guest
So I have a question. Did anyone actually get this to work? Don't get me wrong it installs and runs fine in the container, but I could never get it to adopt my devices.
docker stop unifi

rm -rf /opt/appdata/unifi

then reinstall the app i made some changes in the yml file
 

crichtonguy

Citizen
Sep 16, 2018
3
1
Thanks! I'll give it a shot tonight and report back.

I deployed it outside of pgblitz but I had to update the controller settings via the GUI to get it to work. Clicked Override inform host with controller hostname/ip, then put the server IP in the Controller Hostname/IP field. It immediately found my WAP and adopted it.

Slam, bam, thank you wan.
 

Attachments

losjax

Citizen+
Donor
Aug 25, 2018
23
6
Ok, thanks for all the help, I got it to adopt my devices. One caveat, the yaml pulls a very old version of Unifi: 5.6.2, when 5.10.23 is the latest. I modified mine to pull the latest one and saved it in the mycontainers folder. I know there have been some security patches so you might want to look into this.
 

28061

Citizen
Feb 25, 2019
14
2
Ok, thanks for all the help, I got it to adopt my devices. One caveat, the yaml pulls a very old version of Unifi: 5.6.2, when 5.10.23 is the latest. I modified mine to pull the latest one and saved it in the mycontainers folder. I know there have been some security patches so you might want to look into this.
Thanks for adding the unifi controller - it's one of the last local services that I can move to the cloud server!
I also initially had adoption issues, resolved using the instructions above.
Can you tell me how I can get it to install 5.10.23 please?
 

losjax

Citizen+
Donor
Aug 25, 2018
23
6
Thanks for adding the unifi controller - it's one of the last local services that I can move to the cloud server!
I also initially had adoption issues, resolved using the instructions above.
Can you tell me how I can get it to install 5.10.23 please?
Update to 8.6.4, the Unifi installer should pull the latest version.
 

losjax

Citizen+
Donor
Aug 25, 2018
23
6
Didn't do so for me I'm afraid. It's still pulling 5.6.42
Ok, make a new file call unifi-latest.yaml, paste in the code below and save it to opt/mycontainers. It will show in the Community Apps and you can install it from there.
YAML:
#!/bin/bash
#
# Title:      PGBlitz (Reference Title File)
# Author(s):  Admin9705
# URL:        https://pgblitz.com - http://github.pgblitz.com
# GNU:        General Public License v3.0
################################################################################
---
- hosts: localhost
  gather_facts: false
  tasks:
    # FACTS #######################################################################
    - name: 'Set Known Facts'
      set_fact:
        pgrole: 'unifi'
        intport: '3478/udp'
        extport: '3478'
        intport2: '10001/udp'
        extport2: '10001'
        intport3: '8080/tcp'
        extport3: '8088'
        intport4: '8081/tcp'
        extport4: '8081'
        intport5: '8443/tcp'
        extport5: '8443'
        intport6: '8880/tcp'
        extport6: '8880'
        image: 'jacobalberty/unifi:latest'

    # CORE (MANDATORY) ############################################################
    - name: 'Including cron job'
      include_tasks: '/opt/coreapps/apps/_core.yml'

    # LABELS ######################################################################
    - name: 'Adding Traefik'
      set_fact:
        pg_labels:
           traefik.enable: 'true'
           traefik.tags: 'frontend'
           traefik.frontend.passHostHeader: 'true'
           traefik.backend: '{{pgrole}}'
           traefik.admin.frontend.rule: 'Host:{{pgrole}}.{{domain.stdout}},{{tldset}}'
           traefik.admin.port: '{{intport5}}'
           traefik.admin.protocol: 'https'
           traefik.frontend.headers.SSLRedirect: 'true'
           traefik.frontend.headers.STSSeconds: '315360000'
           traefik.frontend.headers.browserXSSFilter: 'true'
           traefik.frontend.headers.contentTypeNosniff: 'true'
           traefik.frontend.headers.forceSTSHeader: 'true'
           traefik.frontend.headers.SSLHost: '{{domain.stdout}}'
           traefik.frontend.headers.STSIncludeSubdomains: 'true'
           traefik.frontend.headers.STSPreload: 'true'
           traefik.frontend.headers.frameDeny: 'true'     
              
    - name: 'Setting PG Volumes'
      set_fact:
        pg_volumes:
          - '/opt/appdata/{{pgrole}}:/config'
          - '/etc/localtime:/etc/localtime:ro'

    - name: 'Setting PG ENV'
      set_fact:
        pg_env:
          PUID: '1000'
          PGID: '1000'
          TZ: '${TZ}'
          
    # MAIN DEPLOYMENT #############################################################
    - name: 'Deploying {{pgrole}}'
      docker_container:
        name: '{{pgrole}}'
        image: '{{image}}'
        pull: yes
        published_ports:
          - '{{extport}}:{{intport}}'
          - '{{extport2}}:{{intport2}}'
          - '{{extport3}}:{{intport3}}'
          - '{{extport4}}:{{intport4}}'
          - '{{extport5}}:{{intport5}}'
          - '{{extport6}}:{{intport6}}'
        volumes: '{{pg_volumes}}'
        env: '{{pg_env}}'
        restart_policy: always
        networks:
          - name: plexguide
            aliases:
              - '{{pgrole}}'
        state: started
        labels: '{{pg_labels}}'

##PG-Community

##PG-Community

##PG-Community
 

Recommend NewsGroups

      Up To a 58% Discount!

Trending