Initial commit with previous code

This commit is contained in:
Antonio J. Delgado 2022-10-11 10:18:59 +03:00
commit 2e6a84cc61
6 changed files with 88 additions and 0 deletions

32
defaults/main.yml Normal file
View file

@ -0,0 +1,32 @@
---
http_port: 8096
hostname: jellyfin.example.org
configure_apache: true
vhosts:
- vhostname: "{{ hostname }}"
weight: 25
web_port: 80
ssl_port: 443
ssl: yes
docroot: "/var/www/{{ hostname }}"
serveradmin: "webmaster@{{ hostname }}"
server_aliases: []
root_options:
- '-Indexes'
- '-FollowSymLinks'
aliases: []
# - dest: my_page
# src: /var/www/my_page
directories: []
# - path: /var/www/host.example.org/custom_dir
# options:
# - '-Indexes'
# - '-FollowSymLinks'
# allow_override: None
# require: 'all granted'
# custom_code: ""
custom_code: ""
# ldap:
# url: ldap://ldap.example.org/ou=People,ou=Users,dc=example,dc=org?uid
# require: valid-user
reverse_proxy: "http://127.0.0.1:{{ http_port }}/"

5
handlers/main.yml Normal file
View file

@ -0,0 +1,5 @@
---
- name: Restart Jellyfin
service:
name: jellyfin
state: restarted

19
tasks/configure.yml Normal file
View file

@ -0,0 +1,19 @@
---
- name: Ensure ufw allow connections
ufw:
rule: allow
port: "{{ http_port }}"
#- name: Ensure Jellyfin is configured
# notify: Restart Jellyfin
- name: Ensure Apache2 is configured to redirect to Jellyfin
include_role:
name: apache_ssl_vhosts
when: configure_apache
- name: Ensure Jellyfin service is configured
service:
name: jellyfin
enabled: true
state: started

10
tasks/install.yml Normal file
View file

@ -0,0 +1,10 @@
---
- name: Ensure requirements are installed
package:
name:
- curl
- gnupg
- name: Ensure Ubuntu installation is done
include_tasks: install_ubuntu.yml
when: ansible_facts["distribution"] == "Ubuntu"

16
tasks/install_ubuntu.yml Normal file
View file

@ -0,0 +1,16 @@
---
- name: Ensure repository key is added to keyring
apt_key:
url: https://repo.jellyfin.org/ubuntu/jellyfin_team.gpg.key
keyring: /etc/apt/trusted.gpg.d/jellyfin.gpg
#curl -fsSL https://repo.jellyfin.org/ubuntu/jellyfin_team.gpg.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/jellyfin.gpg
- name: Ensure repository is configured
apt_repository:
repo: "deb [arch={{ ansible_facts['facter_os']['architecture'] }}] https://repo.jellyfin.org/{{ ansible_facts['distribution'] | lower }} {{ ansible_facts['distribution_release'] }} main"
state: present
#echo "deb [arch=$( dpkg --print-architecture )] https://repo.jellyfin.org/$( awk -F'=' '/^ID=/{ print $NF }' /etc/os-release ) $( awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release ) main" | sudo tee /etc/apt/sources.list.d/jellyfin.list
- name: Ensure Jellyfin package is installed
package:
name: jellyfin

6
tasks/main.yml Normal file
View file

@ -0,0 +1,6 @@
---
- name: Ensure installation of Jellyfin
include_tasks: install.yml
- name: Ensure configuration of Jellyfin
include_tasks: configure.yml