audiobookshelf: Initial version of role
This commit is contained in:
parent
a793f59a33
commit
4c7c0e3261
5 changed files with 132 additions and 0 deletions
90
roles/audiobookshelf/tasks/main.yml
Normal file
90
roles/audiobookshelf/tasks/main.yml
Normal file
|
@ -0,0 +1,90 @@
|
|||
---
|
||||
- name: Enable repository
|
||||
ansible.builtin.yum_repository:
|
||||
name: audiobookshelf
|
||||
baseurl: https://raw.githubusercontent.com/lkiesow/audiobookshelf-rpm/el$releasever/
|
||||
description: Audiobookshelf el$releasever repository
|
||||
gpgcheck: true
|
||||
gpgkey: https://raw.githubusercontent.com/lkiesow/audiobookshelf-rpm/main/audiobookshelf-rpm.key
|
||||
enabled: true
|
||||
|
||||
- name: Install packcages
|
||||
ansible.builtin.package:
|
||||
name: audiobookshelf
|
||||
state: present
|
||||
|
||||
- name: Create data directories
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
mode: "0770"
|
||||
owner: root
|
||||
group: audiobookshelf
|
||||
with_items:
|
||||
- /export/audiobookshelf
|
||||
- /export/audiobookshelf/audiobooks
|
||||
- /export/audiobookshelf/config
|
||||
- /export/audiobookshelf/metadata
|
||||
- /export/audiobookshelf/podcasts
|
||||
- /export/audiobookshelf/radioplays
|
||||
|
||||
- name: Link data directory
|
||||
ansible.builtin.file:
|
||||
dest: /srv/audiobookshelf
|
||||
src: /export/audiobookshelf
|
||||
state: link
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
follow: false
|
||||
|
||||
- name: Copy naming instructions
|
||||
ansible.builtin.copy:
|
||||
dest: /srv/audiobookshelf/audiobooks/README.md
|
||||
src: meta.md
|
||||
mode: "0644"
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
|
||||
- name: Copy service config
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/default/audiobookshelf
|
||||
src: audiobookshelf.default
|
||||
mode: "0644"
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
notify: Restart audiobookshelf
|
||||
|
||||
- name: Enable service
|
||||
ansible.builtin.service:
|
||||
name: audiobookshelf
|
||||
state: started
|
||||
enabled: true
|
||||
|
||||
- name: Allow nginx to connect audiobookshelf
|
||||
ansible.posix.seboolean:
|
||||
name: httpd_can_network_connect
|
||||
state: true
|
||||
persistent: true
|
||||
|
||||
- name: Copy nginx config
|
||||
ansible.builtin.copy:
|
||||
dest: "/etc/nginx/conf.d/{{ inventory_hostname }}/audiobookshelf.conf"
|
||||
content: |
|
||||
location / {
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header Host audiobooks.foo.sh;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_http_version 1.1;
|
||||
proxy_pass http://127.0.0.1:13378/;
|
||||
location /audiobookshelf/api/upload {
|
||||
# increase size to allow uploads
|
||||
client_max_body_size 10g;
|
||||
proxy_pass http://127.0.0.1:13378/api/upload;
|
||||
}
|
||||
}
|
||||
mode: "0644"
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
notify: Restart nginx
|
Loading…
Add table
Add a link
Reference in a new issue