aboutsummaryrefslogtreecommitdiff
path: root/roles/calibre/tasks/main.yml
diff options
context:
space:
mode:
authorGravatar meisterfischy <grbmn@kstn.in> 2022-01-22 17:17:33 +0100
committerGravatar meisterfischy <grbmn@kstn.in> 2022-01-22 17:17:33 +0100
commita28793b684b3299c95e04924ed18e0fe5cd6f107 (patch)
treeb91a6de277fd71f51f0e1ef9e9fdf1ff872c4104 /roles/calibre/tasks/main.yml
parent07fbef0c792f8a6d0bade63aa4ec7372391a8696 (diff)
downloadansible_collection-a28793b684b3299c95e04924ed18e0fe5cd6f107.tar.gz
Added a role for a calibre-web server
Diffstat (limited to 'roles/calibre/tasks/main.yml')
-rw-r--r--roles/calibre/tasks/main.yml56
1 files changed, 56 insertions, 0 deletions
diff --git a/roles/calibre/tasks/main.yml b/roles/calibre/tasks/main.yml
new file mode 100644
index 0000000..705d167
--- /dev/null
+++ b/roles/calibre/tasks/main.yml
@@ -0,0 +1,56 @@
+---
+- name: Install packages
+ apt:
+ name:
+ - calibre
+ - python3-pip
+ - libsasl2-dev
+ - libldap2-dev
+ - libssl-dev
+ become: true
+
+- name: Check library existence
+ stat:
+ path: /opt/calibre/library
+ register: library
+
+- name: Copy first book
+ copy:
+ dest: /opt/calibre
+ src: white.pdf
+ become: true
+ when: not library.stat.exists
+
+- name: Initialize calibre library
+ shell:
+ cmd: calibredb --library-path=library add white.pdf & calibredb --library-path=library remove 1
+ chdir: /opt/calibre
+ creates: library
+ become: true
+
+- name: Change ownership of calibre library
+ file:
+ path: /opt/calibre/library
+ recurse: true
+ owner: calibre
+ group: calibre
+ become: true
+
+- name: Remove first book file
+ file:
+ path: /opt/calibre/white.pdf
+ state: absent
+ become: true
+ when: not library.stat.exists
+
+- name: Install calibre web with pip
+ pip:
+ name: calibreweb[{{ features | join(",") }}]
+ become: true
+
+- name: Create systemd unit
+ template:
+ dest: /etc/systemd/system/cps.service
+ src: cps.service.j2
+ become: true
+ notify: Restart cps