Add multi-domain support for Jellyfin
- Allow Jellyfin to operate on multiple domains via Host rule config - Move Cloudflare API tokens from Ansible inventory to manual file - Minor formatting
This commit is contained in:
parent
3102c621f0
commit
77c9b12186
@ -15,7 +15,7 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- traefik
|
- traefik
|
||||||
labels:
|
labels:
|
||||||
- "traefik.http.routers.{{ jellyfin_router }}.rule=Host(`{{ jellyfin_domain }}`)"
|
- "traefik.http.routers.{{ jellyfin_router }}.rule=Host({{ jellyfin_domains }})"
|
||||||
{% if traefik_http_only %}
|
{% if traefik_http_only %}
|
||||||
- "traefik.http.routers.{{ jellyfin_router }}.entrypoints=web"
|
- "traefik.http.routers.{{ jellyfin_router }}.entrypoints=web"
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -45,10 +45,11 @@
|
|||||||
register: nginx_sites
|
register: nginx_sites
|
||||||
|
|
||||||
- name: Generate self-signed certificate
|
- name: Generate self-signed certificate
|
||||||
ansible.builtin.command: 'openssl req -newkey rsa:4096 -x509 -sha256 -days 3650 -nodes \
|
ansible.builtin.command:
|
||||||
-subj "/C=US/ST=Local/L=Local/O=Org/OU=IT/CN=example.com" \
|
'openssl req -newkey rsa:4096 -x509 -sha256 -days 3650 -nodes \
|
||||||
-keyout /etc/ssl/private/nginx-selfsigned.key \
|
-subj "/C=US/ST=Local/L=Local/O=Org/OU=IT/CN=example.com" \
|
||||||
-out /etc/ssl/certs/nginx-selfsigned.crt'
|
-keyout /etc/ssl/private/nginx-selfsigned.key \
|
||||||
|
-out /etc/ssl/certs/nginx-selfsigned.crt'
|
||||||
args:
|
args:
|
||||||
creates: /etc/ssl/certs/nginx-selfsigned.crt
|
creates: /etc/ssl/certs/nginx-selfsigned.crt
|
||||||
when: proxy.production is not defined or not proxy.production
|
when: proxy.production is not defined or not proxy.production
|
||||||
@ -56,15 +57,22 @@
|
|||||||
|
|
||||||
- name: Install LE's certbot
|
- name: Install LE's certbot
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
name: ['certbot', 'python3-certbot-dns-cloudflare']
|
name: ["certbot", "python3-certbot-dns-cloudflare"]
|
||||||
state: present
|
state: present
|
||||||
when: proxy.production is defined and proxy.production
|
when: proxy.production is defined and proxy.production
|
||||||
|
|
||||||
|
- name: Grab Cloudflare API token for configuration
|
||||||
|
ansible.builtin.slurp:
|
||||||
|
src: /root/.cloudflare-api
|
||||||
|
register: cfapi
|
||||||
|
when: proxy.production is defined and proxy.production and proxy.dns_cloudflare is defined
|
||||||
|
|
||||||
- name: Install Cloudflare API token
|
- name: Install Cloudflare API token
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: cloudflare.ini.j2
|
src: cloudflare.ini.j2
|
||||||
dest: /root/.cloudflare.ini
|
dest: /root/.cloudflare.ini
|
||||||
mode: "400"
|
mode: "400"
|
||||||
|
diff: false
|
||||||
when: proxy.production is defined and proxy.production and proxy.dns_cloudflare is defined
|
when: proxy.production is defined and proxy.production and proxy.dns_cloudflare is defined
|
||||||
|
|
||||||
- name: Create nginx post renewal hook directory
|
- name: Create nginx post renewal hook directory
|
||||||
@ -78,19 +86,19 @@
|
|||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: reload-nginx.sh
|
src: reload-nginx.sh
|
||||||
dest: /etc/letsencrypt/renewal-hooks/post/reload-nginx.sh
|
dest: /etc/letsencrypt/renewal-hooks/post/reload-nginx.sh
|
||||||
mode: '0755'
|
mode: "0755"
|
||||||
when: proxy.production is defined and proxy.production
|
when: proxy.production is defined and proxy.production
|
||||||
|
|
||||||
- name: Run Cloudflare DNS-01 challenges on wildcard domains
|
- name: Run Cloudflare DNS-01 challenges on wildcard domains
|
||||||
ansible.builtin.shell: '/usr/bin/certbot certonly \
|
ansible.builtin.shell: '/usr/bin/certbot certonly \
|
||||||
--non-interactive \
|
--non-interactive \
|
||||||
--agree-tos \
|
--agree-tos \
|
||||||
--email "{{ proxy.dns_cloudflare.email }}" \
|
--email "{{ proxy.dns_cloudflare.email }}" \
|
||||||
--dns-cloudflare \
|
--dns-cloudflare \
|
||||||
--dns-cloudflare-credentials /root/.cloudflare.ini \
|
--dns-cloudflare-credentials /root/.cloudflare.ini \
|
||||||
-d "*.{{ item }}" \
|
-d "*.{{ item }}" \
|
||||||
-d "{{ item }}" \
|
-d "{{ item }}" \
|
||||||
{{ proxy.dns_cloudflare.opts | default("") }}'
|
{{ proxy.dns_cloudflare.opts | default("") }}'
|
||||||
args:
|
args:
|
||||||
creates: "/etc/letsencrypt/live/{{ item }}/fullchain.pem"
|
creates: "/etc/letsencrypt/live/{{ item }}/fullchain.pem"
|
||||||
loop: "{{ proxy.dns_cloudflare.wildcard_domains }}"
|
loop: "{{ proxy.dns_cloudflare.wildcard_domains }}"
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
# Cloudflare API token used by Certbot
|
# Cloudflare API token used by Certbot
|
||||||
dns_cloudflare_api_token = {{ proxy.dns_cloudflare.api_token }}
|
dns_cloudflare_api_token = {{ cfapi['content'] | b64decode | trim }}
|
||||||
|
Loading…
Reference in New Issue
Block a user