What's new
PGBlitz.com

Register Now! Find useful tips, Interact /w Community Members and join the part the Best Community on the Internet!

Discussion Unifi Controller YAML file

Sejrup

Respected Member
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}}'
 
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

Respected Member
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
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!
 

losjax

Junior Member
Donor
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

Full Member
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

Junior Member
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

Junior Member
Donor
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

Junior Member
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

Junior Member
Donor
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

Junior Member
Donor
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
 

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
B Blitz Apps 0
B Blitz Apps 0
toeffelhelt Ideas & Suggestions 6

Similar threads


Top NZB NewsGroups!

Members - Up To a 58% Discount!

Development Donations

 

Online statistics

Members online
10
Guests online
112
Total visitors
122
Top