Discussion Unifi Controller YAML file

Sejrup

Blitz 1st Class
Original poster
77
26
PG Version
8.5.8
Server Type
Local - Dedicated Server
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: MrDoob

MrDoob

Administrator
Project Manager
Donor
1,461
420
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

Blitz 1st Class
Original poster
77
26
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:

MrDoob

Administrator
Project Manager
Donor
1,461
420
@Sejrup

your app is added ;) in 8.5 and 8.6 ;)
 
  • Like
Reactions: Sejrup

Admin9705

Administrator
Project Manager
5,820
2,008
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: Sejrup

Sejrup

Blitz 1st Class
Original poster
77
26
@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
 

MrDoob

Administrator
Project Manager
Donor
1,461
420
Createn an Pr Request for changing the lines
 

losjax

Blitz 3rd Class
Donor
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

Blitz 2nd Class
28
1
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.
 

MrDoob

Administrator
Project Manager
Donor
1,461
420
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

Blitz 3rd Class
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

Blitz 3rd Class
Donor
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

Blitz 3rd Class
12
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

Blitz 3rd Class
Donor
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

Blitz 3rd Class
Donor
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
 

MrDoob

Administrator
Project Manager
Donor
1,461
420
@losjax

I made the changes ;) direct on the community apps section
 
  • Like
Reactions: losjax

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Thread starter Similar threads Forum Replies Date
Admin9705 Life Chat 15
toeffelhelt Ideas & Suggestions 6

Similar threads


Development Donations

 

Trending