From 2e6a84cc6125e7f162c45431787dd6e62d8d7420 Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Tue, 11 Oct 2022 10:18:59 +0300 Subject: [PATCH] Initial commit with previous code --- defaults/main.yml | 32 ++++++++++++++++++++++++++++++++ handlers/main.yml | 5 +++++ tasks/configure.yml | 19 +++++++++++++++++++ tasks/install.yml | 10 ++++++++++ tasks/install_ubuntu.yml | 16 ++++++++++++++++ tasks/main.yml | 6 ++++++ 6 files changed, 88 insertions(+) create mode 100644 defaults/main.yml create mode 100644 handlers/main.yml create mode 100644 tasks/configure.yml create mode 100644 tasks/install.yml create mode 100644 tasks/install_ubuntu.yml create mode 100644 tasks/main.yml diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..7192417 --- /dev/null +++ b/defaults/main.yml @@ -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 }}/" diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..8f10ade --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: Restart Jellyfin + service: + name: jellyfin + state: restarted \ No newline at end of file diff --git a/tasks/configure.yml b/tasks/configure.yml new file mode 100644 index 0000000..26a6e6a --- /dev/null +++ b/tasks/configure.yml @@ -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 \ No newline at end of file diff --git a/tasks/install.yml b/tasks/install.yml new file mode 100644 index 0000000..ae8b5ca --- /dev/null +++ b/tasks/install.yml @@ -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" diff --git a/tasks/install_ubuntu.yml b/tasks/install_ubuntu.yml new file mode 100644 index 0000000..c73fff0 --- /dev/null +++ b/tasks/install_ubuntu.yml @@ -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 \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..36f4c95 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,6 @@ +--- +- name: Ensure installation of Jellyfin + include_tasks: install.yml + +- name: Ensure configuration of Jellyfin + include_tasks: configure.yml \ No newline at end of file