Skip to content

Commit

Permalink
convert ombi to multiple instances - take 1 (#279)
Browse files Browse the repository at this point in the history
* convert ombi to multiple instances - take 1

* ombi: minor changes to defaults

* ombi: minor changes to tasks main.yml

* ombi: minor changes to tasks main2.yml

* ombix: removed

* ombi: minor formatting

* ombi: additional formatting

* varken: use first Ombi instance

---------

Co-authored-by: Toutas <[email protected]>
Co-authored-by: salty <[email protected]>
  • Loading branch information
3 people authored Sep 1, 2023
1 parent 43f4180 commit de25ea3
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 59 deletions.
54 changes: 28 additions & 26 deletions roles/ombi/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# Basics
################################

ombi_name: ombi
ombi_instances: ["ombi"]

################################
# Paths
Expand All @@ -29,14 +29,15 @@ ombi_paths_folders_list:
ombi_web_subdomain: "{{ ombi_name }}"
ombi_web_domain: "{{ user.domain }}"
ombi_web_port: "3579"
ombi_web_url: "{{ 'https://' + ombi_web_subdomain + '.' + ombi_web_domain }}"
ombi_web_url: "{{ 'https://' + lookup('vars', ombi_name + '_web_subdomain', default=ombi_web_subdomain)
+ '.' + lookup('vars', ombi_name + '_web_domain', default=ombi_web_domain) }}"

################################
# DNS
################################

ombi_dns_record: "{{ ombi_web_subdomain }}"
ombi_dns_zone: "{{ ombi_web_domain }}"
ombi_dns_record: "{{ lookup('vars', ombi_name + '_web_subdomain', default=ombi_web_subdomain) }}"
ombi_dns_zone: "{{ lookup('vars', ombi_name + '_web_domain', default=ombi_web_domain) }}"
ombi_dns_proxy: "{{ dns.proxied }}"

################################
Expand All @@ -60,57 +61,58 @@ ombi_docker_container: "{{ ombi_name }}"

# Image
ombi_docker_image_pull: true
ombi_docker_image_repo: "lscr.io/linuxserver/ombi"
ombi_docker_image_tag: "latest"
ombi_docker_image: "lscr.io/linuxserver/ombi:{{ ombi_docker_image_tag }}"
ombi_docker_image: "{{ lookup('vars', ombi_name + '_docker_image_repo', default=ombi_docker_image_repo)
+ ':' + lookup('vars', ombi_name + '_docker_image_tag', default=ombi_docker_image_tag) }}"

# Ports
ombi_docker_ports_defaults: []
ombi_docker_ports_custom: []
ombi_docker_ports: "{{ ombi_docker_ports_defaults
+ ombi_docker_ports_custom }}"

ombi_docker_ports: "{{ lookup('vars', ombi_name + '_docker_ports_defaults', default=ombi_docker_ports_defaults)
+ lookup('vars', ombi_name + '_docker_ports_custom', default=ombi_docker_ports_custom) }}"
# Envs
ombi_docker_envs_default:
PUID: "{{ uid }}"
PGID: "{{ gid }}"
UMASK: "002"
TZ: "{{ tz }}"
ombi_docker_envs_custom: {}
ombi_docker_envs: "{{ ombi_docker_envs_default
| combine(ombi_docker_envs_custom) }}"
ombi_docker_envs: "{{ lookup('vars', ombi_name + '_docker_envs_default', default=ombi_docker_envs_default)
| combine(lookup('vars', ombi_name + '_docker_envs_custom', default=ombi_docker_envs_custom)) }}"

# Commands
ombi_docker_commands_default: []
ombi_docker_commands_custom: []
ombi_docker_commands: "{{ ombi_docker_commands_default
+ ombi_docker_commands_custom }}"
ombi_docker_commands: "{{ lookup('vars', ombi_name + '_docker_commands_default', default=ombi_docker_commands_default)
+ lookup('vars', ombi_name + '_docker_commands_custom', default=ombi_docker_commands_custom) }}"

# Volumes
ombi_docker_volumes_default:
- "{{ ombi_paths_location }}:/config"
ombi_docker_volumes_custom: []
ombi_docker_volumes: "{{ ombi_docker_volumes_default
+ ombi_docker_volumes_custom }}"
ombi_docker_volumes: "{{ lookup('vars', ombi_name + '_docker_volumes_default', default=ombi_docker_volumes_default)
+ lookup('vars', ombi_name + '_docker_volumes_custom', default=ombi_docker_volumes_custom) }}"

# Devices
ombi_docker_devices_default: []
ombi_docker_devices_custom: []
ombi_docker_devices: "{{ ombi_docker_devices_default
+ ombi_docker_devices_custom }}"
ombi_docker_devices: "{{ lookup('vars', ombi_name + '_docker_devices_default', default=ombi_docker_devices_default)
+ lookup('vars', ombi_name + '_docker_devices_custom', default=ombi_docker_devices_custom) }}"

# Hosts
ombi_docker_hosts_default: []
ombi_docker_hosts_custom: []
ombi_docker_hosts: "{{ docker_hosts_common
| combine(ombi_docker_hosts_default)
| combine(ombi_docker_hosts_custom) }}"
| combine(lookup('vars', ombi_name + '_docker_hosts_default', default=ombi_docker_hosts_default))
| combine(lookup('vars', ombi_name + '_docker_hosts_custom', default=ombi_docker_hosts_custom)) }}"

# Labels
ombi_docker_labels_default: {}
ombi_docker_labels_custom: {}
ombi_docker_labels: "{{ docker_labels_common
| combine(ombi_docker_labels_default)
| combine(ombi_docker_labels_custom) }}"
| combine(lookup('vars', ombi_name + '_docker_labels_default', default=ombi_docker_labels_default))
| combine(lookup('vars', ombi_name + '_docker_labels_custom', default=ombi_docker_labels_custom)) }}"

# Hostname
ombi_docker_hostname: "{{ ombi_name }}"
Expand All @@ -120,20 +122,20 @@ ombi_docker_networks_alias: "{{ ombi_name }}"
ombi_docker_networks_default: []
ombi_docker_networks_custom: []
ombi_docker_networks: "{{ docker_networks_common
+ ombi_docker_networks_default
+ ombi_docker_networks_custom }}"
+ lookup('vars', ombi_name + '_docker_networks_default', default=ombi_docker_networks_default)
+ lookup('vars', ombi_name + '_docker_networks_custom', default=ombi_docker_networks_custom) }}"

# Capabilities
ombi_docker_capabilities_default: []
ombi_docker_capabilities_custom: []
ombi_docker_capabilities: "{{ ombi_docker_capabilities_default
+ ombi_docker_capabilities_custom }}"
ombi_docker_capabilities: "{{ lookup('vars', ombi_name + '_docker_capabilities_default', default=ombi_docker_capabilities_default)
+ lookup('vars', ombi_name + '_docker_capabilities_custom', default=ombi_docker_capabilities_custom) }}"

# Security Opts
ombi_docker_security_opts_default: []
ombi_docker_security_opts_custom: []
ombi_docker_security_opts: "{{ ombi_docker_security_opts_default
+ ombi_docker_security_opts_custom }}"
ombi_docker_security_opts: "{{ lookup('vars', ombi_name + '_docker_security_opts_default', default=ombi_docker_security_opts_default)
+ lookup('vars', ombi_name + '_docker_security_opts_custom', default=ombi_docker_security_opts_custom) }}"

# Restart Policy
ombi_docker_restart_policy: unless-stopped
Expand Down
20 changes: 6 additions & 14 deletions roles/ombi/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,10 @@
# GNU General Public License v3.0 #
#########################################################################
---
- name: Add DNS record
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/dns/tasker.yml"
- name: "Execute Ombi roles"
ansible.builtin.include_tasks: main2.yml
vars:
dns_record: "{{ lookup('vars', role_name + '_dns_record') }}"
dns_zone: "{{ lookup('vars', role_name + '_dns_zone') }}"
dns_proxy: "{{ lookup('vars', role_name + '_dns_proxy') }}"

- name: Remove existing Docker container
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/remove_docker_container.yml"

- name: Create directories
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/directories/create_directories.yml"

- name: Create Docker container
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/create_docker_container.yml"
ombi_name: "{{ role }}"
with_items: "{{ ombi_instances }}"
loop_control:
loop_var: role
24 changes: 24 additions & 0 deletions roles/ombi/tasks/main2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#########################################################################
# Title: Sandbox: Ombi #
# Author(s): RXWatcher1, l3uddz, desimaniac, salty #
# URL: https://github.com/saltyorg/Sandbox #
# -- #
#########################################################################
# GNU General Public License v3.0 #
#########################################################################
---
- name: Add DNS record
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/dns/tasker.yml"
vars:
dns_record: "{{ lookup('vars', role_name + '_dns_record') }}"
dns_zone: "{{ lookup('vars', role_name + '_dns_zone') }}"
dns_proxy: "{{ lookup('vars', role_name + '_dns_proxy') }}"

- name: Remove existing Docker container
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/remove_docker_container.yml"

- name: Create directories
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/directories/create_directories.yml"

- name: Create Docker container
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/create_docker_container.yml"
17 changes: 0 additions & 17 deletions roles/ombix/tasks/main.yml

This file was deleted.

1 change: 0 additions & 1 deletion roles/varken/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
# GNU General Public License v3.0 #
#########################################################################
---

varken_ombi_db: "{{ ombi_paths_location }}/OmbiSettings.db"
varken_radarr_config: "{{ radarr_paths_location }}/config.xml"
varken_sonarr_config: "{{ sonarr_paths_location }}/config.xml"
Expand Down
5 changes: 5 additions & 0 deletions roles/varken/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
tautulli_name: "{{ tautulli_instances[0] }}"
when: not tautulli_name is defined

- name: Set Default Ombi instance
ansible.builtin.set_fact:
ombi_name: "{{ ombi_instances[0] }}"
when: not ombi_name is defined

- name: Set Default Sonarr instance
ansible.builtin.set_fact:
sonarr_name: "{{ sonarr_instances[0] }}"
Expand Down
1 change: 0 additions & 1 deletion sandbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@
- { role: notifiarr, tags: ['notifiarr'] }
- { role: olivetin, tags: ['olivetin'] }
- { role: ombi, tags: ['ombi'] }
- { role: ombix, tags: ['ombix'] }
- { role: omegabrr, tags: ['omegabrr'] }
- { role: ouroboros, tags: ['ouroboros'] }
- { role: paperless_ngx, tags: ['paperless-ngx'] }
Expand Down

0 comments on commit de25ea3

Please sign in to comment.