-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.yml
62 lines (53 loc) · 1.73 KB
/
deploy.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
---
- hosts: all
remote_user: root
vars:
compose_directory: /data/mt-mods-infra
template_files:
- "docker-compose.yml"
- "Dockerfile.nodered"
- "config/matterbridge.toml"
- "config/remotenickformat.tengo"
- "config/nodered.js"
tasks:
- name: Create config directory
file:
path: "{{ compose_directory }}/config"
state: directory
- name: Calculate previous checksums
stat:
path: "{{ compose_directory }}/{{ item }}"
register: "previous_hash"
with_items: "{{ template_files }}"
- name: Copy and template files
template:
src: "{{ item }}"
dest: "{{ compose_directory }}/{{ item }}"
with_items: "{{ template_files }}"
- name: Calculate current checksums
stat:
path: "{{ compose_directory }}/{{ item }}"
register: "current_hash"
with_items: "{{ template_files }}"
- name: Create nodered directory
file:
path: "{{ compose_directory }}/data/nodered"
state: directory
owner: "1000"
group: "1000"
- name: Configure services
docker_compose:
project_src: "{{ compose_directory }}"
pull: yes
build: yes
remove_orphans: yes
- name: Matterbridge restart
docker_compose:
project_src: "{{ compose_directory }}"
restarted: yes
when: previous_hash.results[2].stat.exists and previous_hash.results[2].stat.checksum != current_hash.results[2].stat.checksum
- name: NodeRED restart
docker_compose:
project_src: "{{ compose_directory }}"
restarted: yes
when: previous_hash.results[4].stat.exists and previous_hash.results[4].stat.checksum != current_hash.results[4].stat.checksum