aboutsummaryrefslogtreecommitdiff
path: root/roles/calibre/tasks/main.yml
blob: 705d167221e4bfdac20dac37e019a58ebc244c72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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