Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breakout compose files #100

Merged
merged 15 commits into from
Sep 20, 2024
9 changes: 9 additions & 0 deletions .github/extra-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -325,5 +325,14 @@
"netdata": {
"enabled": true
},
"wizarr": {
"enabled": true,
"proxy_host_rule": "wizarr",
"directory": true,
"traefik": true,
"authentik": false,
"authentik_provider_type": "proxy",
"expose_to_public": false,
},
}
}
9 changes: 9 additions & 0 deletions .github/workflows/run-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ jobs:
chmod 0600 ./inventory/group_vars/all/*.yml
make install-reqs

- name: Run playbook in check mode
run: >-
sudo ansible-playbook
-i inventory/hosts.yml
hms-docker.yml
--diff
--check
--extra-vars "@.github/extra-vars.yml"

- name: Run playbook
run: >-
sudo ansible-playbook
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ update:
@echo Updating from Git repo... && git pull
@echo Updating variable names
@echo Updating Traefik variables
@sed -i 's\traefik_ext_hosts_configs_path\hmsdocker_traefik_static_config_location\g' $(CUSTOM_CONF_DIR)/traefik.yml
@sed -i 's\traefik_ext_hosts_configs_path:\hmsdocker_traefik_static_config_location:\g' $(CUSTOM_CONF_DIR)/traefik.yml
@sed -i 's\hms_docker_library_path\hmsdocker_library_path\g' $(CUSTOM_CONF_DIR)/hmsd_advanced.yml
@echo Update finished

Expand All @@ -87,4 +87,4 @@ help:
@echo make apply :: apply any changes identified in the diff
@echo make install-reqs :: installs ansible galaxy role requirements
@echo make verify-containers :: checks containers exposed ports \(used in GitHub Actions\)
@echo update :: updates from the git repo and updates variable names (if they were changed)
@echo make update :: updates from the git repo and updates variable names (if they were changed)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Ansible Playbook to setup an automated Home Media Server stack running on Docker
- [Recyclarr](https://github.com/recyclarr/recyclarr): auto-sync for [TRaSH guides](https://trash-guides.info/)
- [PASTA](https://github.com/cglatot/pasta): audio and subtitle management
- [Netdata](https://github.com/netdata/netdata): observability

- [Wizarr](https://github.com/wizarrrr/wizarr): media server invite management

## Other Features

Expand Down
1 change: 1 addition & 0 deletions docs/Container Map.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ If you choose to expose the container ports on the host (by setting `container_e
| Speedtest-Tracker | ☐ | `speedtest` | `8090`, `8444` | `8080`, `8443` | ☑ |
| tinyMediaManager | ☐ | `tmm` | `5900`, `4000` | `5900`, `4000` | ☑ |
| PASTA | ☐ | `pasta` | `8085` | `80` | ☑ |
| Wizarr | ☐ | `wizarr` | `5690` | `5690` | ☑ |

If both Jellyfin and Emby are enabled, then Emby will be available on ports `8097` and `8921` (if ports are being exposed for both)
8 changes: 8 additions & 0 deletions docs/Release Notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

Note that any update to a new version might need to be done manually using a `make update` since some variables may now be deprecated/renamed.

## Version 1.5

Modularize the main Docker Compose file to import other containers from files in order to drasitcally reduce line count and make it easier to modify individual containers

New container:

* Wizarr

## Version 1.4

New containers:
Expand Down
11 changes: 4 additions & 7 deletions hms-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
become: yes
gather_facts: yes
vars:
hmsd_current_version: 1.4
hmsd_current_version: 1.5
hmsd_version_file: "{{ hms_docker_data_path }}/.hmsd-version"
regex: '[^A-Za-z0-9._-]'
replace: '_'
Expand All @@ -25,13 +25,10 @@

- name: Verify all Traefik endpoints are accessible
ansible.builtin.uri:
url: http://{{ item.value.proxy_host_rule }}.{{ hms_docker_domain }}
url: http://{{ item }}.{{ hms_docker_domain }}
status_code: 200,302,401,403
validate_certs: no
with_dict:
- "{{ hms_docker_container_map }}"
loop: "{{ traefik_enabled_subdomains }}"
when:
- item.value.traefik is defined and item.value.traefik
- item.value.enabled is defined and item.value.enabled
- hmsdocker_container_enabled_traefik
- traefik_verify_endpoints is defined and traefik_verify_endpoints
- traefik_verify_endpoints | default(false)
8 changes: 8 additions & 0 deletions roles/hmsdocker/defaults/main/container_map.yml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,14 @@ hms_docker_container_map:
expose_to_public: no
netdata:
enabled: no
wizarr:
enabled: no
proxy_host_rule: wizarr
directory: yes
traefik: yes
authentik: no
authentik_provider_type: proxy
expose_to_public: no



131 changes: 20 additions & 111 deletions roles/hmsdocker/tasks/generate_compose_files.yml
Original file line number Diff line number Diff line change
@@ -1,138 +1,47 @@
- name: Ensure compose_files directory exists
ansible.builtin.file:
dest: "{{ hms_docker_data_path }}/compose_files"
state: directory
mode: 0755
owner: "{{ container_uid }}"
group: "{{ container_gid }}"
register: compose_dir

- name: Generate Docker Compose file for Maintainerr
when: hmsdocker_container_enabled_maintainerr
ansible.builtin.template:
src: containers/maintainerr.yml.j2
dest: "{{ compose_dir.dest | default(hms_docker_data_path + '/compose_files') }}/maintainerr.yml"
owner: "{{ container_uid }}"
group: "{{ container_gid }}"
mode: 0644
trim_blocks: yes
lstrip_blocks: yes
register: maintainerr_compose_file

- name: Generate Docker Compose file for Unpackerr
when: hmsdocker_container_enabled_unpackerr
ansible.builtin.template:
src: containers/unpackerr.yml.j2
dest: "{{ compose_dir.dest | default(hms_docker_data_path + '/compose_files') }}/unpackerr.yml"
owner: "{{ container_uid }}"
group: "{{ container_gid }}"
mode: 0644
trim_blocks: yes
lstrip_blocks: yes
register: unpackerr_compose_file

- name: Generate Docker Compose file for Lidarr
when: hmsdocker_container_enabled_lidarr
ansible.builtin.template:
src: containers/lidarr.yml.j2
dest: "{{ compose_dir.dest | default(hms_docker_data_path + '/compose_files') }}/lidarr.yml"
owner: "{{ container_uid }}"
group: "{{ container_gid }}"
mode: 0644
trim_blocks: yes
lstrip_blocks: yes
register: lidarr_compose_file

- name: Generate Docker Compose file for Autobrr
when: hmsdocker_container_enabled_autobrr
ansible.builtin.template:
src: containers/autobrr.yml.j2
dest: "{{ compose_dir.dest | default(hms_docker_data_path + '/compose_files') }}/autobrr.yml"
owner: "{{ container_uid }}"
group: "{{ container_gid }}"
mode: 0644
trim_blocks: yes
lstrip_blocks: yes
register: autobrr_compose_file

- name: Generate Docker Compose file for Notifiarr
when: hmsdocker_container_enabled_notifiarr
ansible.builtin.template:
src: containers/notifiarr.yml.j2
dest: "{{ compose_dir.dest | default(hms_docker_data_path + '/compose_files') }}/notifiarr.yml"
owner: "{{ container_uid }}"
group: "{{ container_gid }}"
mode: 0644
trim_blocks: yes
lstrip_blocks: yes
register: notifiarr_compose_file

- name: Generate Docker Compose file for Speedtest Tracker
when: hmsdocker_container_enabled_speedtest
- name: Generate Docker Compose files for Watchtower
when: container_enable_auto_updates
ansible.builtin.template:
src: containers/speedtest-tracker.yml.j2
dest: "{{ compose_dir.dest | default(hms_docker_data_path + '/compose_files') }}/speedtest-tracker.yml"
src: containers/watchtower.yml.j2
dest: "{{ compose_dir.dest | default(hms_docker_data_path + '/compose_files') }}/watchtower.yml"
owner: "{{ container_uid }}"
group: "{{ container_gid }}"
mode: 0644
trim_blocks: yes
lstrip_blocks: yes
register: speedtest_compose_file

- name: Generate Docker Compose file for Recyclarr
when: hmsdocker_container_enabled_recyclarr
block:
- name: Ensure Recyclarr config
ansible.builtin.template:
src: recyclarr_conf.yml.j2
dest: "{{ hms_docker_apps_path }}/recyclarr/config/recyclarr.yml"
owner: "{{ container_uid }}"
group: "{{ container_gid }}"
mode: 0644
force: "{{ hmsdocker_recyclarr_force_config_update }}"
trim_blocks: yes
lstrip_blocks: yes

- name: Generate Docker Compose file for Recyclarr
ansible.builtin.template:
src: containers/recyclarr.yml.j2
dest: "{{ compose_dir.dest | default(hms_docker_data_path + '/compose_files') }}/recyclarr.yml"
owner: "{{ container_uid }}"
group: "{{ container_gid }}"
mode: 0644
trim_blocks: yes
lstrip_blocks: yes
register: recyclarr_compose_file
register: watchtower_compose_file_path

- name: Generate Docker Compose file for TinyMediaManager
- name: Generate Docker Compose files for Cloudflare
when: cloudflare_ddns_enabled | default(false) or cloudflare_tunnel_enabled| default(false)
ansible.builtin.template:
src: containers/tinymediamanager.yml.j2
dest: "{{ compose_dir.dest | default(hms_docker_data_path + '/compose_files') }}/tinymediamanager.yml"
src: containers/cloudflare.yml.j2
dest: "{{ compose_dir.dest | default(hms_docker_data_path + '/compose_files') }}/cloudflare.yml"
owner: "{{ container_uid }}"
group: "{{ container_gid }}"
mode: 0644
trim_blocks: yes
lstrip_blocks: yes
register: tinymediamanager_compose_file
register: cloudflare_compose_file_path

- name: Generate Docker Compose file for PASTA
- name: Generate Docker Compose files for Flaresolverr
when: flaresolverr_enabled
ansible.builtin.template:
src: containers/pasta.yml.j2
dest: "{{ compose_dir.dest | default(hms_docker_data_path + '/compose_files') }}/pasta.yml"
src: containers/flaresolverr.yml.j2
dest: "{{ compose_dir.dest | default(hms_docker_data_path + '/compose_files') }}/flaresolverr.yml"
owner: "{{ container_uid }}"
group: "{{ container_gid }}"
mode: 0644
trim_blocks: yes
lstrip_blocks: yes
register: pasta_compose_file
register: flaresolverr_compose_file_path

- name: Generate Docker Compose file for Netdata
- name: Generate Docker Compose files for Authentik
when: hmsdocker_authentik_enabled_globally
ansible.builtin.template:
src: containers/netdata.yml.j2
dest: "{{ compose_dir.dest | default(hms_docker_data_path + '/compose_files') }}/netdata.yml"
src: containers/authentik.yml.j2
dest: "{{ compose_dir.dest | default(hms_docker_data_path + '/compose_files') }}/authentik.yml"
owner: "{{ container_uid }}"
group: "{{ container_gid }}"
mode: 0644
trim_blocks: yes
lstrip_blocks: yes
register: netdata_compose_file
register: authentik_compose_file_path
Loading