Advertisement
ptr727

Untitled

Jul 26th, 2023
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. # Networks are in lexical order, make sure public is default
  2. # https://github.com/moby/moby/pull/22086
  3. docker_public_network: "aaa_publicnet"
  4. # Bind to specific host network interface
  5. docker_public_network_parent: "vmbr1"
  6. docker_public_network_subnet: "192.168.1.0/24"
  7. docker_public_network_gateway: "192.168.1.1"
  8. docker_local_network: "localnet"
  9.  
  10. # Create Docker macvlan Network
  11. # https://docs.ansible.com/ansible/latest/collections/community/docker/docker_network_module.html
  12. - name: "Create Docker macvlan Network"
  13. notify:
  14. - "Restart Docker Service"
  15. community.docker.docker_network:
  16. name: "{{ docker_public_network }}"
  17. driver: macvlan
  18. driver_options:
  19. parent: "{{ docker_public_network_parent }}"
  20. ipam_config:
  21. - subnet: "{{ docker_public_network_subnet }}"
  22. gateway: "{{ docker_public_network_gateway }}"
  23.  
  24. # Create Docker bridge Network
  25. # https://docs.ansible.com/ansible/latest/collections/community/docker/docker_network_module.html
  26. - name: "Create Docker bridge Network"
  27. notify:
  28. - "Restart Docker Service"
  29. community.docker.docker_network:
  30. name: "{{ docker_local_network }}"
  31. driver: bridge
  32.  
  33. # https://docs.ansible.com/ansible/latest/collections/community/docker/docker_container_module.html
  34. - name: "Install UniFi Console"
  35. community.docker.docker_container:
  36. name: unifi
  37. image: docker.io/linuxserver/unifi-controller:latest
  38. pull: yes
  39. hostname: unifi
  40. domainname: "{{ ansible_domain }}"
  41. restart_policy: unless-stopped
  42. env:
  43. TZ: "{{ local_timezone }}"
  44. PUID: "{{ user_id }}"
  45. PGID: "{{ group_id }}"
  46. volumes:
  47. - "{{ appdata_dir }}/unifi/config:/config"
  48. networks:
  49. - name: "{{ docker_public_network }}"
  50. ipv4_address: 192.168.1.2 # unifi.home.insanegenius.net
  51. - name: "{{ docker_local_network }}"
  52. # published_ports:
  53. # External routing via static IP, and static IP
  54. # - 8443:8443
  55. labels:
  56. # Route using unifi-console CNAME, unifi name is used for direct controller access
  57. traefik.enable: "true"
  58. traefik.http.routers.unifi.rule: "Host(`unifi-console.{{ ansible_domain }}`) || Host(`unifi-console.{{ external_services_domain }}`)"
  59. traefik.http.routers.unifi.entrypoints: "websecure"
  60. # Manually specify port and schema
  61. traefik.http.services.unifi.loadbalancer.server.scheme: "https"
  62. traefik.http.services.unifi.loadbalancer.server.port: "8443"
  63. com.centurylinklabs.watchtower.enable: "true"
  64. recreate: "{{ docker_container_recreate }}"
  65.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement