aboutsummaryrefslogtreecommitdiff
path: root/roles/calibre/tasks/main.yml
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2022-01-22 20:30:31 +0100
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2022-01-22 20:30:31 +0100
commit1c7ffdae0fa70e066dee294e11bc7569c429c321 (patch)
tree03eee786d902054515794294998c1b9574f5142e /roles/calibre/tasks/main.yml
parentd400f8820ad8e824ce454d9283e2bb8d6a28cdd3 (diff)
parentea10f2c231ba6fa4f77b20ff25993f87297b5952 (diff)
downloadansible_collection-1c7ffdae0fa70e066dee294e11bc7569c429c321.tar.gz
Merge branch 'meisterfischy-calibre' into dev
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..d3b0d06
--- /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: Download first book
+ get_url:
+ url: https://github.com/progit/progit2/releases/download/2.1.336/progit.pdf
+ dest: /opt/calibre/progit.pdf
+ become: true
+ when: not library.stat.exists
+
+- name: Initialize calibre library
+ shell:
+ cmd: calibredb --library-path=library add progit.pdf
+ 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/progit.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