aboutsummaryrefslogtreecommitdiff
path: root/roles/services/containers/arr_stack
diff options
context:
space:
mode:
authorSam Chudnick <sam@chudnick.com>2023-06-25 09:52:36 -0400
committerSam Chudnick <sam@chudnick.com>2023-06-25 09:52:36 -0400
commit95b73daa36b23565a8566f71f9b202d3459b685f (patch)
treecb17b021be70e7868d0ec235a761f0ecdc80f3f2 /roles/services/containers/arr_stack
Initial CommitHEADmaster
Diffstat (limited to 'roles/services/containers/arr_stack')
-rw-r--r--roles/services/containers/arr_stack/handlers/main.yml4
-rw-r--r--roles/services/containers/arr_stack/tasks/gluetun.yml105
-rw-r--r--roles/services/containers/arr_stack/tasks/lidarr.yml93
-rw-r--r--roles/services/containers/arr_stack/tasks/main.yml130
-rw-r--r--roles/services/containers/arr_stack/tasks/prowlarr.yml92
-rw-r--r--roles/services/containers/arr_stack/tasks/qbittorrent.yml94
-rw-r--r--roles/services/containers/arr_stack/tasks/radarr.yml93
-rw-r--r--roles/services/containers/arr_stack/tasks/readarr.yml93
-rw-r--r--roles/services/containers/arr_stack/tasks/sonarr.yml93
9 files changed, 797 insertions, 0 deletions
diff --git a/roles/services/containers/arr_stack/handlers/main.yml b/roles/services/containers/arr_stack/handlers/main.yml
new file mode 100644
index 0000000..5463835
--- /dev/null
+++ b/roles/services/containers/arr_stack/handlers/main.yml
@@ -0,0 +1,4 @@
1- name: restart nginx
2 service:
3 name: nginx
4 state: restarted
diff --git a/roles/services/containers/arr_stack/tasks/gluetun.yml b/roles/services/containers/arr_stack/tasks/gluetun.yml
new file mode 100644
index 0000000..e47d55a
--- /dev/null
+++ b/roles/services/containers/arr_stack/tasks/gluetun.yml
@@ -0,0 +1,105 @@
1- name: set image fact
2 set_fact:
3 image: qmcgaw/gluetun:v3.34.3
4
5- name: set other facts
6 vars:
7 array: "{{ image.split('/', 1) }}"
8 set_fact:
9 repo_tag: "{{ array.1 }}"
10 custom_registry: "{{ docker_registry_url + '/' + docker_registry_username }}"
11
12- name: create gluetun directory
13 file:
14 path: "{{ docker_home }}/gluetun"
15 state: directory
16 owner: "{{ docker_username }}"
17 group: "{{ docker_username }}"
18 mode: '0755'
19
20- name: create gluetun data directory
21 file:
22 path: "{{ docker_home }}/gluetun/data"
23 state: directory
24 owner: "{{ docker_username }}"
25 group: "{{ docker_username }}"
26 mode: '0755'
27
28- name: login to docker registry
29 become: yes
30 become_user: "{{ docker_username }}"
31 environment:
32 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
33 docker_login:
34 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
35 registry_url: "{{ docker_registry_url }}"
36 username: "{{ docker_registry_username }}"
37 password: "{{ docker_registry_password }}"
38
39- name: pull and push gluetun image
40 become: yes
41 become_user: "{{ docker_username }}"
42 environment:
43 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
44 docker_image:
45 name: "{{ image }}"
46 repository: "{{ custom_registry }}/{{ repo_tag }}"
47 push: yes
48 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
49 source: pull
50 force_source: yes
51
52- name: create gluetun docker network
53 docker_network:
54 name: "{{ gluetun_network_name }}"
55 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
56 driver: bridge
57 ipam_config:
58 - subnet: "{{ gluetun_subnet }}"
59 gateway: "{{ gluetun_gateway }}"
60
61- name: create and deploy gluetun container
62 become: yes
63 become_user: "{{ docker_username }}"
64 environment:
65 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
66 docker_container:
67 name: "gluetun"
68 hostname: "gluetun"
69 image: "{{ custom_registry }}/{{ repo_tag }}"
70 recreate: yes
71 pull: yes
72 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
73 capabilities:
74 - net_admin
75 devices:
76 - "/dev/net/tun:/dev/net/tun"
77 purge_networks: yes
78 networks:
79 - name: "{{ gluetun_network_name }}"
80 ipv4_address: "{{ gluetun_ipv4 }}"
81 ports:
82 - "127.0.0.1:{{ qbittorrent_external_port }}:{{ qbittorrent_external_port }}"
83 - "127.0.0.1:{{ sonarr_external_port }}:8989"
84 - "127.0.0.1:{{ radarr_external_port }}:7878"
85 - "127.0.0.1:{{ lidarr_external_port }}:8686"
86 - "127.0.0.1:{{ readarr_external_port }}:8787"
87 - "127.0.0.1:{{ prowlarr_external_port }}:9696"
88 state: 'started'
89 comparisons:
90 '*': strict
91 restart_policy: unless-stopped
92 env:
93 "TZ": "{{ timezone }}"
94 "VPN_SERVICE_PROVIDER": "mullvad"
95 "VPN_TYPE": "wireguard"
96 "WIREGUARD_PRIVATE_KEY": "{{ wireguard_privkey }}"
97 "WIREGUARD_ADDRESSES": "{{ wireguard_addrs }}"
98 "SERVER_CITIES": "{{ gluetun_cities }}"
99 "DOT_PROVIDERS": "quad9"
100 "BLOCK_MALICIOUS": "on"
101 "BLOCK_SURVEILLANCE": "on"
102 "BLOCK_ADS": "on"
103 "HEALTH_TARGET_ADDRESS": "www.debian.org:443"
104 volumes:
105 - "{{ docker_home }}/gluetun/data:/gluetun"
diff --git a/roles/services/containers/arr_stack/tasks/lidarr.yml b/roles/services/containers/arr_stack/tasks/lidarr.yml
new file mode 100644
index 0000000..1f70437
--- /dev/null
+++ b/roles/services/containers/arr_stack/tasks/lidarr.yml
@@ -0,0 +1,93 @@
1- name: set image fact
2 set_fact:
3 image: linuxserver/lidarr:1.2.6-nightly
4
5- name: set other facts
6 vars:
7 array: "{{ image.split('/', 1) }}"
8 set_fact:
9 repo_tag: "{{ array.1 }}"
10 custom_registry: "{{ docker_registry_url + '/' + docker_registry_username }}"
11
12- name: create lidarr directory
13 file:
14 path: "{{ docker_home }}/lidarr"
15 state: directory
16 owner: "{{ docker_username }}"
17 group: "{{ docker_username }}"
18 mode: '0755'
19
20- name: create lidarr config directory
21 file:
22 path: "{{ docker_home }}/lidarr/config"
23 state: directory
24 owner: "{{ docker_username }}"
25 group: "{{ docker_username }}"
26 mode: '0755'
27
28- name: login to docker registry
29 become: yes
30 become_user: "{{ docker_username }}"
31 environment:
32 xdg_runtime_dir: "/run/user/{{ docker_uid }}"
33 docker_login:
34 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
35 registry_url: "{{ docker_registry_url }}"
36 username: "{{ docker_registry_username }}"
37 password: "{{ docker_registry_password }}"
38
39- name: pull and push lidarr image
40 become: yes
41 become_user: "{{ docker_username }}"
42 environment:
43 xdg_runtime_dir: "/run/user/{{ docker_uid }}"
44 docker_image:
45 name: "{{ image }}"
46 repository: "{{ custom_registry }}/{{ repo_tag }}"
47 push: yes
48 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
49 source: pull
50 force_source: yes
51
52- name: create and deploy lidarr container
53 become: yes
54 become_user: "{{ docker_username }}"
55 environment:
56 xdg_runtime_dir: "/run/user/{{ docker_uid }}"
57 docker_container:
58 name: "lidarr"
59 image: "{{ custom_registry }}/{{ repo_tag }}"
60 recreate: yes
61 pull: yes
62 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
63 purge_networks: yes
64 network_mode: "container:gluetun"
65 state: 'started'
66 comparisons:
67 '*': strict
68 restart_policy: unless-stopped
69 env:
70 "tz": "{{ timezone }}"
71 "PUID": "0"
72 "PGID": "0"
73 volumes:
74 - "{{ docker_home }}/lidarr/config:/config"
75 - "{{ docker_home }}/arr/data:/data"
76
77- name: deploy nginx configuration
78 notify: restart nginx
79 register: nginx_config
80 template:
81 src: "{{ lidarr_nginx_config }}"
82 dest: /etc/nginx/sites-available/lidarr.conf
83 owner: root
84 group: root
85 mode: '0644'
86
87- name: symlink site
88 file:
89 src: /etc/nginx/sites-available/lidarr.conf
90 dest: /etc/nginx/sites-enabled/lidarr.conf
91 owner: root
92 group: root
93 state: link
diff --git a/roles/services/containers/arr_stack/tasks/main.yml b/roles/services/containers/arr_stack/tasks/main.yml
new file mode 100644
index 0000000..ee27384
--- /dev/null
+++ b/roles/services/containers/arr_stack/tasks/main.yml
@@ -0,0 +1,130 @@
1- name: create arr directory structure
2 file:
3 path: "{{ docker_home }}/arr"
4 state: directory
5 owner: "{{ docker_username }}"
6 group: "{{ docker_username }}"
7 mode: '0775'
8- name: create arr directory structure
9 file:
10 path: "{{ docker_home }}/arr/data"
11 state: directory
12 owner: "{{ docker_username }}"
13 group: "{{ docker_username }}"
14 mode: '0775'
15
16- name: create arr/data directory structure
17 file:
18 path: "{{ docker_home }}/arr/data/torrents"
19 state: directory
20 owner: "{{ docker_username }}"
21 group: "{{ docker_username }}"
22 mode: '0775'
23- name: create arr/data directory structure
24 file:
25 path: "{{ docker_home }}/arr/data/torrents/movies"
26 state: directory
27 owner: "{{ docker_username }}"
28 group: "{{ docker_username }}"
29 mode: '0775'
30- name: create arr/data directory structure
31 file:
32 path: "{{ docker_home }}/arr/data/torrents/music"
33 state: directory
34 owner: "{{ docker_username }}"
35 group: "{{ docker_username }}"
36 mode: '0775'
37- name: create arr/data directory structure
38 file:
39 path: "{{ docker_home }}/arr/data/torrents/books"
40 state: directory
41 owner: "{{ docker_username }}"
42 group: "{{ docker_username }}"
43 mode: '0775'
44- name: create arr/data directory structure
45 file:
46 path: "{{ docker_home }}/arr/data/torrents/tv"
47 state: directory
48 owner: "{{ docker_username }}"
49 group: "{{ docker_username }}"
50 mode: '0775'
51
52- name: create arr/data directory structure
53 file:
54 path: "{{ docker_home }}/arr/data/usenet"
55 state: directory
56 owner: "{{ docker_username }}"
57 group: "{{ docker_username }}"
58 mode: '0775'
59- name: create arr/data directory structure
60 file:
61 path: "{{ docker_home }}/arr/data/usenet/movies"
62 state: directory
63 owner: "{{ docker_username }}"
64 group: "{{ docker_username }}"
65 mode: '0775'
66- name: create arr/data directory structure
67 file:
68 path: "{{ docker_home }}/arr/data/usenet/music"
69 state: directory
70 owner: "{{ docker_username }}"
71 group: "{{ docker_username }}"
72 mode: '0775'
73- name: create arr/data directory structure
74 file:
75 path: "{{ docker_home }}/arr/data/usenet/books"
76 state: directory
77 owner: "{{ docker_username }}"
78 group: "{{ docker_username }}"
79 mode: '0775'
80- name: create arr/data directory structure
81 file:
82 path: "{{ docker_home }}/arr/data/usenet/tv"
83 state: directory
84 owner: "{{ docker_username }}"
85 group: "{{ docker_username }}"
86 mode: '0775'
87
88- name: create arr/data directory structure
89 file:
90 path: "{{ docker_home }}/arr/data/media"
91 state: directory
92 owner: "{{ docker_username }}"
93 group: "{{ docker_username }}"
94 mode: '0775'
95- name: create arr/data directory structure
96 file:
97 path: "{{ docker_home }}/arr/data/media/movies"
98 state: directory
99 owner: "{{ docker_username }}"
100 group: "{{ docker_username }}"
101 mode: '0775'
102- name: create arr/data directory structure
103 file:
104 path: "{{ docker_home }}/arr/data/media/music"
105 state: directory
106 owner: "{{ docker_username }}"
107 group: "{{ docker_username }}"
108 mode: '0775'
109- name: create arr/data directory structure
110 file:
111 path: "{{ docker_home }}/arr/data/media/books"
112 state: directory
113 owner: "{{ docker_username }}"
114 group: "{{ docker_username }}"
115 mode: '0775'
116- name: create arr/data directory structure
117 file:
118 path: "{{ docker_home }}/arr/data/media/tv"
119 state: directory
120 owner: "{{ docker_username }}"
121 group: "{{ docker_username }}"
122 mode: '0775'
123
124- include_tasks: gluetun.yml
125- include_tasks: qbittorrent.yml
126- include_tasks: sonarr.yml
127- include_tasks: radarr.yml
128- include_tasks: lidarr.yml
129- include_tasks: readarr.yml
130- include_tasks: prowlarr.yml
diff --git a/roles/services/containers/arr_stack/tasks/prowlarr.yml b/roles/services/containers/arr_stack/tasks/prowlarr.yml
new file mode 100644
index 0000000..53f1a45
--- /dev/null
+++ b/roles/services/containers/arr_stack/tasks/prowlarr.yml
@@ -0,0 +1,92 @@
1- name: set image fact
2 set_fact:
3 image: linuxserver/prowlarr:1.6.2-nightly
4
5- name: set other facts
6 vars:
7 array: "{{ image.split('/', 1) }}"
8 set_fact:
9 repo_tag: "{{ array.1 }}"
10 custom_registry: "{{ docker_registry_url + '/' + docker_registry_username }}"
11
12- name: create prowlarr directory
13 file:
14 path: "{{ docker_home }}/prowlarr"
15 state: directory
16 owner: "{{ docker_username }}"
17 group: "{{ docker_username }}"
18 mode: '0755'
19
20- name: create prowlarr config directory
21 file:
22 path: "{{ docker_home }}/prowlarr/config"
23 state: directory
24 owner: "{{ docker_username }}"
25 group: "{{ docker_username }}"
26 mode: '0755'
27
28- name: login to docker registry
29 become: yes
30 become_user: "{{ docker_username }}"
31 environment:
32 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
33 docker_login:
34 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
35 registry_url: "{{ docker_registry_url }}"
36 username: "{{ docker_registry_username }}"
37 password: "{{ docker_registry_password }}"
38
39- name: pull and push prowlarr image
40 become: yes
41 become_user: "{{ docker_username }}"
42 environment:
43 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
44 docker_image:
45 name: "{{ image }}"
46 repository: "{{ custom_registry }}/{{ repo_tag }}"
47 push: yes
48 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
49 source: pull
50 force_source: yes
51
52- name: create and deploy prowlarr container
53 become: yes
54 become_user: "{{ docker_username }}"
55 environment:
56 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
57 docker_container:
58 name: "prowlarr"
59 image: "{{ custom_registry }}/{{ repo_tag }}"
60 recreate: yes
61 pull: yes
62 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
63 purge_networks: yes
64 network_mode: "container:gluetun"
65 state: 'started'
66 comparisons:
67 '*': strict
68 restart_policy: unless-stopped
69 env:
70 "TZ": "{{ timezone }}"
71 "PUID": "0"
72 "PGID": "0"
73 volumes:
74 - "{{ docker_home }}/prowlarr/config:/config"
75
76- name: deploy nginx configuration
77 notify: restart nginx
78 register: nginx_config
79 template:
80 src: "{{ prowlarr_nginx_config }}"
81 dest: /etc/nginx/sites-available/prowlarr.conf
82 owner: root
83 group: root
84 mode: '0644'
85
86- name: symlink site
87 file:
88 src: /etc/nginx/sites-available/prowlarr.conf
89 dest: /etc/nginx/sites-enabled/prowlarr.conf
90 owner: root
91 group: root
92 state: link
diff --git a/roles/services/containers/arr_stack/tasks/qbittorrent.yml b/roles/services/containers/arr_stack/tasks/qbittorrent.yml
new file mode 100644
index 0000000..25e554f
--- /dev/null
+++ b/roles/services/containers/arr_stack/tasks/qbittorrent.yml
@@ -0,0 +1,94 @@
1- name: set image fact
2 set_fact:
3 image: linuxserver/qbittorrent:4.5.4
4
5- name: set other facts
6 vars:
7 array: "{{ image.split('/', 1) }}"
8 set_fact:
9 repo_tag: "{{ array.1 }}"
10 custom_registry: "{{ docker_registry_url + '/' + docker_registry_username }}"
11
12- name: create qbittorrent directory
13 file:
14 path: "{{ docker_home }}/qbittorrent"
15 state: directory
16 owner: "{{ docker_username }}"
17 group: "{{ docker_username }}"
18 mode: '0755'
19
20- name: create qbittorrent config directory
21 file:
22 path: "{{ docker_home }}/qbittorrent/config"
23 state: directory
24 owner: "{{ docker_username }}"
25 group: "{{ docker_username }}"
26 mode: '0755'
27
28- name: login to docker registry
29 become: yes
30 become_user: "{{ docker_username }}"
31 environment:
32 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
33 docker_login:
34 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
35 registry_url: "{{ docker_registry_url }}"
36 username: "{{ docker_registry_username }}"
37 password: "{{ docker_registry_password }}"
38
39- name: pull and push qbittorrent image
40 become: yes
41 become_user: "{{ docker_username }}"
42 environment:
43 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
44 docker_image:
45 name: "{{ image }}"
46 repository: "{{ custom_registry }}/{{ repo_tag }}"
47 push: yes
48 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
49 source: pull
50 force_source: yes
51
52- name: create and deploy qbittorrent container
53 become: yes
54 become_user: "{{ docker_username }}"
55 environment:
56 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
57 docker_container:
58 name: "qbittorrent"
59 image: "{{ custom_registry }}/{{ repo_tag }}"
60 recreate: yes
61 pull: yes
62 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
63 purge_networks: yes
64 network_mode: "container:gluetun"
65 state: 'started'
66 comparisons:
67 '*': strict
68 restart_policy: unless-stopped
69 env:
70 "TZ": "{{ timezone }}"
71 "WEBUI_PORT": "{{ qbittorrent_external_port }}"
72 "PUID": "0"
73 "PGID": "0"
74 volumes:
75 - "{{ docker_home }}/qbittorrent/config:/config"
76 - "{{ docker_home }}/arr/data:/data"
77
78- name: deploy nginx configuration
79 notify: restart nginx
80 register: nginx_config
81 template:
82 src: "{{ qbittorrent_nginx_config }}"
83 dest: /etc/nginx/sites-available/qbittorrent.conf
84 owner: root
85 group: root
86 mode: '0644'
87
88- name: symlink site
89 file:
90 src: /etc/nginx/sites-available/qbittorrent.conf
91 dest: /etc/nginx/sites-enabled/qbittorrent.conf
92 owner: root
93 group: root
94 state: link
diff --git a/roles/services/containers/arr_stack/tasks/radarr.yml b/roles/services/containers/arr_stack/tasks/radarr.yml
new file mode 100644
index 0000000..2e98c47
--- /dev/null
+++ b/roles/services/containers/arr_stack/tasks/radarr.yml
@@ -0,0 +1,93 @@
1- name: set image fact
2 set_fact:
3 image: linuxserver/radarr:4.6.4-nightly
4
5- name: set other facts
6 vars:
7 array: "{{ image.split('/', 1) }}"
8 set_fact:
9 repo_tag: "{{ array.1 }}"
10 custom_registry: "{{ docker_registry_url + '/' + docker_registry_username }}"
11
12- name: create radarr directory
13 file:
14 path: "{{ docker_home }}/radarr"
15 state: directory
16 owner: "{{ docker_username }}"
17 group: "{{ docker_username }}"
18 mode: '0755'
19
20- name: create radarr config directory
21 file:
22 path: "{{ docker_home }}/radarr/config"
23 state: directory
24 owner: "{{ docker_username }}"
25 group: "{{ docker_username }}"
26 mode: '0755'
27
28- name: login to docker registry
29 become: yes
30 become_user: "{{ docker_username }}"
31 environment:
32 xdg_runtime_dir: "/run/user/{{ docker_uid }}"
33 docker_login:
34 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
35 registry_url: "{{ docker_registry_url }}"
36 username: "{{ docker_registry_username }}"
37 password: "{{ docker_registry_password }}"
38
39- name: pull and push radarr image
40 become: yes
41 become_user: "{{ docker_username }}"
42 environment:
43 xdg_runtime_dir: "/run/user/{{ docker_uid }}"
44 docker_image:
45 name: "{{ image }}"
46 repository: "{{ custom_registry }}/{{ repo_tag }}"
47 push: yes
48 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
49 source: pull
50 force_source: yes
51
52- name: create and deploy radarr container
53 become: yes
54 become_user: "{{ docker_username }}"
55 environment:
56 xdg_runtime_dir: "/run/user/{{ docker_uid }}"
57 docker_container:
58 name: "radarr"
59 image: "{{ custom_registry }}/{{ repo_tag }}"
60 recreate: yes
61 pull: yes
62 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
63 purge_networks: yes
64 network_mode: "container:gluetun"
65 state: 'started'
66 comparisons:
67 '*': strict
68 restart_policy: unless-stopped
69 env:
70 "tz": "{{ timezone }}"
71 "PUID": "0"
72 "PGID": "0"
73 volumes:
74 - "{{ docker_home }}/radarr/config:/config"
75 - "{{ docker_home }}/arr/data:/data"
76
77- name: deploy nginx configuration
78 notify: restart nginx
79 register: nginx_config
80 template:
81 src: "{{ radarr_nginx_config }}"
82 dest: /etc/nginx/sites-available/radarr.conf
83 owner: root
84 group: root
85 mode: '0644'
86
87- name: symlink site
88 file:
89 src: /etc/nginx/sites-available/radarr.conf
90 dest: /etc/nginx/sites-enabled/radarr.conf
91 owner: root
92 group: root
93 state: link
diff --git a/roles/services/containers/arr_stack/tasks/readarr.yml b/roles/services/containers/arr_stack/tasks/readarr.yml
new file mode 100644
index 0000000..bd8b2ec
--- /dev/null
+++ b/roles/services/containers/arr_stack/tasks/readarr.yml
@@ -0,0 +1,93 @@
1- name: set image fact
2 set_fact:
3 image: linuxserver/readarr:0.2.0-nightly
4
5- name: set other facts
6 vars:
7 array: "{{ image.split('/', 1) }}"
8 set_fact:
9 repo_tag: "{{ array.1 }}"
10 custom_registry: "{{ docker_registry_url + '/' + docker_registry_username }}"
11
12- name: create readarr directory
13 file:
14 path: "{{ docker_home }}/readarr"
15 state: directory
16 owner: "{{ docker_username }}"
17 group: "{{ docker_username }}"
18 mode: '0755'
19
20- name: create readarr config directory
21 file:
22 path: "{{ docker_home }}/readarr/config"
23 state: directory
24 owner: "{{ docker_username }}"
25 group: "{{ docker_username }}"
26 mode: '0755'
27
28- name: login to docker registry
29 become: yes
30 become_user: "{{ docker_username }}"
31 environment:
32 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
33 docker_login:
34 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
35 registry_url: "{{ docker_registry_url }}"
36 username: "{{ docker_registry_username }}"
37 password: "{{ docker_registry_password }}"
38
39- name: pull and push readarr image
40 become: yes
41 become_user: "{{ docker_username }}"
42 environment:
43 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
44 docker_image:
45 name: "{{ image }}"
46 repository: "{{ custom_registry }}/{{ repo_tag }}"
47 push: yes
48 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
49 source: pull
50 force_source: yes
51
52- name: create and deploy readarr container
53 become: yes
54 become_user: "{{ docker_username }}"
55 environment:
56 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
57 docker_container:
58 name: "readarr"
59 image: "{{ custom_registry }}/{{ repo_tag }}"
60 recreate: yes
61 pull: yes
62 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
63 purge_networks: yes
64 network_mode: "container:gluetun"
65 state: 'started'
66 comparisons:
67 '*': strict
68 restart_policy: unless-stopped
69 env:
70 "TZ": "{{ timezone }}"
71 "PUID": "0"
72 "PGID": "0"
73 volumes:
74 - "{{ docker_home }}/readarr/config:/config"
75 - "{{ docker_home }}/arr/data:/data"
76
77- name: deploy nginx configuration
78 notify: restart nginx
79 register: nginx_config
80 template:
81 src: "{{ readarr_nginx_config }}"
82 dest: /etc/nginx/sites-available/readarr.conf
83 owner: root
84 group: root
85 mode: '0644'
86
87- name: symlink site
88 file:
89 src: /etc/nginx/sites-available/readarr.conf
90 dest: /etc/nginx/sites-enabled/readarr.conf
91 owner: root
92 group: root
93 state: link
diff --git a/roles/services/containers/arr_stack/tasks/sonarr.yml b/roles/services/containers/arr_stack/tasks/sonarr.yml
new file mode 100644
index 0000000..ac712ba
--- /dev/null
+++ b/roles/services/containers/arr_stack/tasks/sonarr.yml
@@ -0,0 +1,93 @@
1- name: set image fact
2 set_fact:
3 image: linuxserver/sonarr:develop-version-4.0.0.433
4
5- name: set other facts
6 vars:
7 array: "{{ image.split('/', 1) }}"
8 set_fact:
9 repo_tag: "{{ array.1 }}"
10 custom_registry: "{{ docker_registry_url + '/' + docker_registry_username }}"
11
12- name: create sonarr directory
13 file:
14 path: "{{ docker_home }}/sonarr"
15 state: directory
16 owner: "{{ docker_username }}"
17 group: "{{ docker_username }}"
18 mode: '0755'
19
20- name: create sonarr config directory
21 file:
22 path: "{{ docker_home }}/sonarr/config"
23 state: directory
24 owner: "{{ docker_username }}"
25 group: "{{ docker_username }}"
26 mode: '0755'
27
28- name: login to docker registry
29 become: yes
30 become_user: "{{ docker_username }}"
31 environment:
32 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
33 docker_login:
34 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
35 registry_url: "{{ docker_registry_url }}"
36 username: "{{ docker_registry_username }}"
37 password: "{{ docker_registry_password }}"
38
39- name: pull and push sonarr image
40 become: yes
41 become_user: "{{ docker_username }}"
42 environment:
43 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
44 docker_image:
45 name: "{{ image }}"
46 repository: "{{ custom_registry }}/{{ repo_tag }}"
47 push: yes
48 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
49 source: pull
50 force_source: yes
51
52- name: create and deploy sonarr container
53 become: yes
54 become_user: "{{ docker_username }}"
55 environment:
56 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
57 docker_container:
58 name: "sonarr"
59 image: "{{ custom_registry }}/{{ repo_tag }}"
60 recreate: yes
61 pull: yes
62 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
63 purge_networks: yes
64 network_mode: "container:gluetun"
65 state: 'started'
66 comparisons:
67 '*': strict
68 restart_policy: unless-stopped
69 env:
70 "TZ": "{{ timezone }}"
71 "PUID": "0"
72 "PGID": "0"
73 volumes:
74 - "{{ docker_home }}/sonarr/config:/config"
75 - "{{ docker_home }}/arr/data:/data"
76
77- name: deploy nginx configuration
78 notify: restart nginx
79 register: nginx_config
80 template:
81 src: "{{ sonarr_nginx_config }}"
82 dest: /etc/nginx/sites-available/sonarr.conf
83 owner: root
84 group: root
85 mode: '0644'
86
87- name: symlink site
88 file:
89 src: /etc/nginx/sites-available/sonarr.conf
90 dest: /etc/nginx/sites-enabled/sonarr.conf
91 owner: root
92 group: root
93 state: link