aboutsummaryrefslogtreecommitdiff
path: root/roles/services/containers/navidrome/tasks
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/navidrome/tasks
Initial CommitHEADmaster
Diffstat (limited to 'roles/services/containers/navidrome/tasks')
-rw-r--r--roles/services/containers/navidrome/tasks/main.yml117
1 files changed, 117 insertions, 0 deletions
diff --git a/roles/services/containers/navidrome/tasks/main.yml b/roles/services/containers/navidrome/tasks/main.yml
new file mode 100644
index 0000000..e95e849
--- /dev/null
+++ b/roles/services/containers/navidrome/tasks/main.yml
@@ -0,0 +1,117 @@
1- name: set image fact
2 set_fact:
3 image: deluan/navidrome:0.49.2
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 navidrome directory
13 file:
14 path: "{{ docker_home }}/navidrome"
15 state: directory
16 owner: "{{ docker_username }}"
17 group: "{{ docker_username }}"
18 mode: '0755'
19
20- name: create navidrome data directory
21 file:
22 path: "{{ docker_home }}/navidrome/data"
23 state: directory
24 owner: "{{ docker_username }}"
25 group: "{{ docker_username }}"
26 mode: '0755'
27
28- name: create navidrome music directory
29 file:
30 path: "{{ docker_home }}/navidrome/music"
31 state: directory
32 owner: "{{ docker_username }}"
33 group: "{{ docker_username }}"
34 mode: '0755'
35
36- name: login to docker registry
37 become: yes
38 become_user: "{{ docker_username }}"
39 environment:
40 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
41 docker_login:
42 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
43 registry_url: "{{ docker_registry_url }}"
44 username: "{{ docker_registry_username }}"
45 password: "{{ docker_registry_password }}"
46
47- name: pull and push navidrome image
48 become: yes
49 become_user: "{{ docker_username }}"
50 environment:
51 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
52 docker_image:
53 name: "{{ image }}"
54 repository: "{{ custom_registry }}/{{ repo_tag }}"
55 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
56 source: pull
57 force_source: yes
58 push: yes
59
60- name: create navidrome docker network
61 docker_network:
62 name: "{{ navidrome_network_name }}"
63 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
64 driver: bridge
65 ipam_config:
66 - subnet: "{{ navidrome_subnet }}"
67 gateway: "{{ navidrome_gateway }}"
68
69- name: create and deploy navidrome container
70 become: yes
71 become_user: "{{ docker_username }}"
72 environment:
73 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
74 docker_container:
75 name: "navidrome"
76 hostname: "navidrome"
77 image: "{{ custom_registry }}/{{ repo_tag }}"
78 pull: yes
79 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
80 purge_networks: yes
81 networks:
82 - name: "{{ navidrome_network_name }}"
83 ipv4_address: "{{ navidrome_ipv4 }}"
84 ports:
85 - "127.0.0.1:4533:4533"
86 state: 'started'
87 recreate: yes
88 restart_policy: unless-stopped
89 env:
90 "ND_AUTHREQUEST_LIMIT": "2"
91 "ND_PASSWORDENCRYPTIONKEY": "{{ navidrome_encryptionkey }}"
92 "ND_LASTFM_ENABLED": "false"
93 "ND_PROMETHEUS_ENABLED": "true"
94 "ND_PROMETHEUS_METRICSPATH": "/metrics"
95 "ND_REVERSEPROXYWHITELIST": "172.25.5.0/24"
96 "ND_LOGLEVEL": "debug"
97 volumes:
98 - "{{ docker_home }}/navidrome/data:/data"
99 - "{{ docker_home }}/arr/data/media/music:/music:ro"
100
101- name: deploy nginx configuration
102 notify: restart nginx
103 register: nginx_config
104 copy:
105 src: "{{ navidrome_nginx_config }}"
106 dest: /etc/nginx/sites-available/navidrome.conf
107 owner: root
108 group: root
109 mode: '0644'
110
111- name: symlink site
112 file:
113 src: /etc/nginx/sites-available/navidrome.conf
114 dest: /etc/nginx/sites-enabled/navidrome.conf
115 owner: root
116 group: root
117 state: link