diff --git a/group_vars/all.yml b/group_vars/all.yml index ea422fcb..e96fa8dc 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -62,7 +62,6 @@ wallabag_enabled: false # Home Automation mosquitto_enabled: false -homebridge_enabled: false openhab_enabled: false # Books @@ -291,16 +290,6 @@ pytivo_podcasts_directory: "{{ podcasts_root }}" pytivo_user_id: "0" pytivo_group_id: "0" -### -### Homebridge -### -homebridge_available_externally: "false" -homebridge_config_directory: "{{ docker_home }}/homebridge/config" -homebridge_user_id: "0" -homebridge_group_id: "0" -homebridge_port: "8087" - - ### ### Tautulli ### diff --git a/nas.yml b/nas.yml index b3d30af3..4083e61d 100644 --- a/nas.yml +++ b/nas.yml @@ -98,6 +98,11 @@ - homeassistant when: (homeassistant_enabled | default(False)) + - role: homebridge + tags: + - homebridge + when: (homebridge_enabled | default(False)) + - role: lidarr tags: - lidarr @@ -271,10 +276,6 @@ when: (mosquitto_enabled | default(False)) tags: mosquitto - - import_tasks: tasks/homebridge.yml - when: (homebridge_enabled | default(False)) - tags: homebridge - - import_tasks: tasks/calibre.yml when: (calibre_enabled | default(False)) tags: calibre diff --git a/roles/homebridge/defaults/main.yml b/roles/homebridge/defaults/main.yml new file mode 100644 index 00000000..700a817f --- /dev/null +++ b/roles/homebridge/defaults/main.yml @@ -0,0 +1,18 @@ +--- +# enable or disable the application +homebridge_enabled: false +homebridge_available_externally: "false" + +# directories +homebridge_config_directory: "{{ docker_home }}/homebridge/config" + +# uid / gid +homebridge_user_id: "0" +homebridge_group_id: "0" + +# network +homebridge_hostname: "homebridge" +homebridge_port: "8087" + +# specs +homebridge_memory: "1g" diff --git a/tasks/homebridge.yml b/roles/homebridge/tasks/main.yml similarity index 80% rename from tasks/homebridge.yml rename to roles/homebridge/tasks/main.yml index f54c42db..7ea1343f 100644 --- a/tasks/homebridge.yml +++ b/roles/homebridge/tasks/main.yml @@ -3,17 +3,18 @@ file: path: "{{ item }}" state: directory + # mode: 0755 with_items: - "{{ homebridge_config_directory }}" -- name: Homebridge Docker Container +- name: Create Homebridge Docker Container docker_container: name: homebridge image: oznu/homebridge pull: true volumes: - "{{ homebridge_config_directory }}:/homebridge" - network_mode: host + network_mode: "host" env: TZ: "{{ ansible_nas_timezone }}" PGID: "{{ homebridge_group_id }}" @@ -21,10 +22,10 @@ HOMEBRIDGE_CONFIG_UI: "1" HOMEBRIDGE_CONFIG_UI_PORT: "{{ homebridge_port }}" restart_policy: unless-stopped - memory: 1g + memory: "{{ homebridge_memory }}" labels: traefik.enable: "{{ homebridge_available_externally }}" - traefik.http.routers.homebridge.rule: "Host(`homebridge.{{ ansible_nas_domain }}`)" + traefik.http.routers.homebridge.rule: "Host(`{{ homebridge_hostname }}.{{ ansible_nas_domain }}`)" traefik.http.routers.homebridge.tls.certresolver: "letsencrypt" traefik.http.routers.homebridge.tls.domains[0].main: "{{ ansible_nas_domain }}" traefik.http.routers.homebridge.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"