/
/
/
Ansible role that provisions my storage server.
1---
2# Storage Services Validation and Health Checks
3
4- name: Check Docker daemon status
5 systemd:
6 name: docker
7 state: started
8 check_mode: no
9
10- name: Verify storage network exists
11 community.docker.docker_network_info:
12 name: "{{ storage_docker_network }}"
13 register: storage_network_info
14
15- name: Verify arr network exists
16 community.docker.docker_network_info:
17 name: "{{ arr_docker_network }}"
18 register: arr_network_info
19
20- name: Display network status
21 debug:
22 msg: |
23 Storage network {{ storage_docker_network }} is available: {{ storage_network_info.exists }}
24 Arr network {{ arr_docker_network }} is available: {{ arr_network_info.exists }}
25 when: storage_network_info.exists or arr_network_info.exists
26
27- name: Check service directories exist
28 stat:
29 path: "{{ item.path }}"
30 register: service_dir_check
31 changed_when: false
32 loop:
33 - { name: "Jellyfin", path: "{{ jellyfin_data_dir }}", enabled: "{{ jellyfin_enabled }}" }
34 - { name: "Arr Stack", path: "{{ arr_config_dir }}", enabled: "{{ arr_stack_enabled }}" }
35 - { name: "Calibre Stack", path: "{{ calibre_config_dir }}", enabled: "{{ calibre_enabled }}" }
36 - { name: "Restic Server", path: "{{ restic_backup_config_dir }}", enabled: "{{ restic_backup_server_enabled }}" }
37 when: item.enabled
38
39- name: Collect container status for enabled services
40 command: docker compose ps --format json
41 args:
42 chdir: "{{ item.item.path }}"
43 register: container_status
44 changed_when: false
45 ignore_errors: true
46 loop: "{{ service_dir_check.results }}"
47 when:
48 - item.item.enabled
49 - item.stat.exists
50
51- name: Verify service health endpoints
52 uri:
53 url: "{{ item.url }}"
54 method: GET
55 status_code: "{{ item.status_code | default(200) }}"
56 validate_certs: no
57 register: service_health
58 changed_when: false
59 ignore_errors: true
60 loop:
61 - { name: "Jellyfin", url: "http://localhost:{{ jellyfin_host_port }}/health", enabled: "{{ jellyfin_enabled }}" }
62 - { name: "Sonarr", url: "http://localhost:{{ sonarr_host_port }}", enabled: "{{ sonarr_enabled }}" }
63 - { name: "Radarr", url: "http://localhost:{{ radarr_host_port }}", enabled: "{{ radarr_enabled }}" }
64 - { name: "Prowlarr", url: "http://localhost:{{ prowlarr_host_port }}", enabled: "{{ prowlarr_enabled }}" }
65 - { name: "LazyLibrarian", url: "http://localhost:{{ lazylibrarian_host_port }}", enabled: "{{ lazylibrarian_enabled }}" }
66 - { name: "Jellyseer", url: "http://localhost:{{ jellyseer_host_port }}", enabled: "{{ jellyseer_enabled }}" }
67 - { name: "Flaresolverr", url: "http://localhost:{{ flaresolverr_host_port }}/health", enabled: "{{ flaresolverr_enabled }}" }
68 - { name: "qBittorrent", url: "http://localhost:{{ qbittorrent_host_port }}", status_code: "[200,401]", enabled: "{{ qbittorrent_enabled }}" }
69 - { name: "Calibre Server", url: "http://localhost:{{ calibre_desktop_gui_host_port }}", enabled: "{{ calibre_server_enabled }}" }
70 - { name: "Calibre-Web", url: "http://localhost:{{ calibre_web_host_port }}", enabled: "{{ calibre_web_enabled }}" }
71 when: item.enabled
72
73- name: Verify directory permissions
74 stat:
75 path: "{{ item }}"
76 register: dir_stats
77 loop:
78 - "{{ storage_docker_dir }}"
79 - "{{ storage_base_path }}"
80 - "{{ jellyfin_data_dir }}"
81 - "{{ arr_config_dir }}"
82 - "{{ calibre_config_dir }}"
83 - "{{ restic_backup_config_dir }}"
84
85- name: Display directory permission status
86 debug:
87 msg: |
88 Directory: {{ item.item }}
89 Owner: {{ item.stat.pw_name | default('unknown') }}:{{ item.stat.gr_name | default('unknown') }}
90 Permissions: {{ item.stat.mode | default('unknown') }}
91 Accessible: {{ item.stat.exists | default(false) }}
92 loop: "{{ dir_stats.results }}"
93 when: item.stat is defined
94
95- name: Check for common configuration issues
96 block:
97 - name: Verify VPN configuration if enabled
98 debug:
99 msg: "WARNING: VPN credentials may need configuration in vault"
100 when:
101 - gluetun_enabled
102 - vpn_service_provider == ""
103
104 - name: Verify backup authentication if enabled
105 debug:
106 msg: "WARNING: Restic authentication credentials need configuration in vault"
107 when:
108 - restic_backup_server_enabled
109 - restic_backup_username == ""
110
111 - name: Check media directory accessibility
112 stat:
113 path: "{{ item }}"
114 register: media_access
115 changed_when: false
116 loop: "{{ media_directories }}"
117
118 - name: Display media directory status
119 debug:
120 msg: "Media directory {{ item.item }} exists: {{ item.stat.exists | default(false) }}"
121 loop: "{{ media_access.results }}"
122 when: item.stat is defined
123
124 rescue:
125 - name: Display configuration warnings
126 debug:
127 msg: |
128 Some configuration issues detected:
129 - Check that all required vault variables are configured
130 - Verify storage paths are accessible
131 - Ensure VPN credentials are set if using Gluetun
132 - Confirm backup authentication is configured
133