/
/
/
Ansible role that provisions my storage server.
1---
2# Calibre Stack Deployment (Calibre + Calibre-Web)
3
4- name: Create Calibre Stack configuration directories
5 file:
6 path: "{{ item }}"
7 state: directory
8 owner: "{{ storage_user }}"
9 group: "{{ storage_group }}"
10 mode: '0755'
11 loop:
12 - "{{ calibre_config_dir }}"
13 - "{{ calibre_server_config_dir }}"
14 - "{{ calibre_web_config_dir }}"
15 - "{{ calibre_library_dir }}"
16 tags: ['calibre', 'directories']
17
18- name: Generate Calibre Stack environment file
19 template:
20 src: calibre-stack.env.j2
21 dest: "{{ calibre_config_dir }}/.env"
22 owner: "{{ storage_user }}"
23 group: "{{ storage_group }}"
24 mode: '0600'
25 notify: restart calibre-stack
26 tags: ['calibre', 'config', 'env']
27
28- name: Deploy Calibre Stack docker-compose configuration
29 template:
30 src: calibre-stack-compose.yml.j2
31 dest: "{{ calibre_config_dir }}/docker-compose.yml"
32 owner: "{{ storage_user }}"
33 group: "{{ storage_group }}"
34 mode: '0644'
35 notify: restart calibre-stack
36 tags: ['calibre', 'config', 'compose']
37
38- name: Start Calibre Stack services
39 community.docker.docker_compose_v2:
40 project_src: "{{ calibre_config_dir }}"
41 state: present
42 tags: ['calibre', 'deploy']
43
44- name: Wait for Calibre services to initialize
45 pause:
46 seconds: 20
47 tags: ['calibre', 'deploy']
48
49- name: Verify Calibre Stack services are running
50 uri:
51 url: "http://localhost:{{ item.port }}"
52 method: GET
53 status_code: [200, 302]
54 register: calibre_health
55 retries: 5
56 delay: 10
57 until: calibre_health.status in [200, 302]
58 ignore_errors: true
59 loop:
60 - { name: "Calibre Server", port: "{{ calibre_server_port }}" }
61 - { name: "Calibre-Web", port: "{{ calibre_web_port }}" }
62 when: calibre_enabled
63 tags: ['calibre', 'validation']
64
65- name: Display Calibre Stack status
66 debug:
67 msg: |
68 Calibre Stack Deployment Status:
69 {% if calibre_server_enabled %}
70 - Calibre Server: http://{{ ansible_default_ipv4.address }}:{{ calibre_server_host_port }}
71 Direct library access and management
72 {% endif %}
73 {% if calibre_web_enabled %}
74 - Calibre-Web: http://{{ ansible_default_ipv4.address }}:{{ calibre_web_host_port }}
75 Web-based library browsing and reading
76 {% endif %}
77
78 Library Directory: {{ calibre_library_dir }}
79 Configuration Directory: {{ calibre_config_dir }}
80
81 Next Steps:
82 1. Access Calibre-Web and complete initial setup
83 2. Import existing ebook library if available
84 3. Configure metadata sources and preferences
85 4. Set up user accounts and permissions
86 5. Configure email settings for ebook delivery
87 tags: ['calibre']