-
Notifications
You must be signed in to change notification settings - Fork 0
/
frigate.yml
74 lines (63 loc) · 1.84 KB
/
frigate.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
- name: Create directories
become: True
file:
path: "{{ item }}"
state: directory
owner: "{{ user }}"
mode: "0700"
loop:
- /var/lib/frigate
- /var/lib/frigate/config
- /var/lib/frigate/storage
- name: Prepare storage
become: True
block:
- name: Create a volume group on "{{ item.value.device }}"
lvg:
vg: "frigate"
pvs: "{{ item.value.device }}"
with_dict: "{{ mounts }}"
- name: Create a logical volume for frigate
lvol:
vg: "frigate"
lv: "{{ item.key }}"
size: "100%FREE"
shrink: False
with_dict: "{{ mounts }}"
- name: Create a filesystem
filesystem:
fstype: "{{ item.value.fstype }}"
dev: "/dev/frigate/{{ item.key }}"
with_dict: "{{ mounts }}"
- name: Mount storage
mount:
path: "/var/lib/frigate/{{ item.key }}"
src: "/dev/frigate/{{ item.key }}"
fstype: "{{ item.value.fstype }}"
state: mounted
with_dict: "{{ mounts }}"
when: mounts is defined
- name: Template files
template:
src: "{{ item.key }}"
dest: "{{ item.value }}"
with_dict:
"template/config.yml.j2": "/var/lib/frigate/config/config.yml"
"template/docker-compose.yml.j2": "/var/lib/frigate/docker-compose.yml"
register: templates
- name: Restart frigate container
community.docker.docker_container:
name: frigate
restart: true
when: templates.results[0].changed and not templates.results[1].changed
- name: Docker compose
block:
- name: Run docker compose up
community.docker.docker_compose_v2:
project_src: /var/lib/frigate
register: output
- name: Show results
ansible.builtin.debug:
var: output.actions
when: templates.results[1].changed