/
/
/
Ansible role that provisions my storage server.
1---
2# Arr Stack Deployment (Sonarr, Radarr, Prowlarr, Readarr + Gluetun VPN)
3
4- name: Create Arr 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 - "{{ arr_config_dir }}"
13 - "{{ sonarr_config_dir }}"
14 - "{{ radarr_config_dir }}"
15 - "{{ prowlarr_config_dir }}"
16 - "{{ readarr_config_dir }}"
17 - "{{ gluetun_config_dir }}"
18 tags: ['arr-stack', 'directories']
19
20- name: Generate Arr Stack environment file
21 template:
22 src: arr-stack.env.j2
23 dest: "{{ arr_config_dir }}/.env"
24 owner: "{{ storage_user }}"
25 group: "{{ storage_group }}"
26 mode: '0600'
27 notify: restart arr-stack
28 tags: ['arr-stack', 'config', 'env']
29
30- name: Deploy Arr Stack docker-compose configuration
31 template:
32 src: arr-stack-compose.yml.j2
33 dest: "{{ arr_config_dir }}/docker-compose.yml"
34 owner: "{{ storage_user }}"
35 group: "{{ storage_group }}"
36 mode: '0644'
37 notify: restart arr-stack
38 tags: ['arr-stack', 'config', 'compose']
39
40- name: Start Arr Stack services
41 community.docker.docker_compose_v2:
42 project_src: "{{ arr_config_dir }}"
43 state: present
44 tags: ['arr-stack', 'deploy']
45
46- name: Wait for VPN connection if enabled
47 pause:
48 seconds: 30
49 when: gluetun_enabled
50 tags: ['arr-stack', 'vpn']
51
52- name: Verify Arr Stack services are running
53 uri:
54 url: "http://localhost:{{ item.port }}"
55 method: GET
56 status_code: [200, 302]
57 register: arr_health
58 retries: 5
59 delay: 10
60 until: arr_health.status in [200, 302]
61 ignore_errors: true
62 loop:
63 - { name: "Sonarr", port: "{{ sonarr_port }}" }
64 - { name: "Radarr", port: "{{ radarr_port }}" }
65 - { name: "Prowlarr", port: "{{ prowlarr_port }}" }
66 - { name: "Readarr", port: "{{ readarr_port }}" }
67 when: arr_stack_enabled
68 tags: ['arr-stack', 'validation']
69
70- name: Display Arr Stack status
71 debug:
72 msg: |
73 Arr Stack Deployment Status:
74 {% if sonarr_enabled %}
75 - Sonarr (TV Shows): http://{{ ansible_default_ipv4.address }}:{{ sonarr_host_port }}
76 {% endif %}
77 {% if radarr_enabled %}
78 - Radarr (Movies): http://{{ ansible_default_ipv4.address }}:{{ radarr_host_port }}
79 {% endif %}
80 {% if prowlarr_enabled %}
81 - Prowlarr (Indexers): http://{{ ansible_default_ipv4.address }}:{{ prowlarr_host_port }}
82 {% endif %}
83 {% if readarr_enabled %}
84 - Readarr (Books): http://{{ ansible_default_ipv4.address }}:{{ readarr_host_port }}
85 {% endif %}
86
87 VPN Status: {{ 'Enabled via Gluetun' if gluetun_enabled else 'Disabled' }}
88 Downloads Directory: {{ arr_downloads_dir }}
89 Configuration Directory: {{ arr_config_dir }}
90
91 Next Steps:
92 1. Configure indexers in Prowlarr
93 2. Set up quality profiles in each Arr app
94 3. Add root folders for media types
95 4. Configure download client settings
96 tags: ['arr-stack']