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
|
# File 'manifests/init.pp', line 16
class zwave (
String $datadir,
String $dongle,
String $hostname,
String $aws_access_key_id,
String $aws_secret_access_key,
String $email,
String $container_ip = '172.17.0.2',
Integer $port = 8443,
Optional[String] $backup_target = undef,
Optional[String] $backup_watchdog = undef,
Optional[String] $backup_password = undef,
Optional[Hash[String, String]] $backup_environment = undef,
Optional[String] $backup_rclone = undef,
) {
file { [$datadir, "${datadir}/store"]:
ensure => directory,
}
-> docker::container { 'zwave':
image => 'zwavejs/zwavejs2mqtt:latest',
args => [
"--device=${dongle}:/dev/zwave",
"-v ${datadir}/store:/usr/src/app/store",
],
cmd => '',
}
nginx::site { $hostname:
proxy_target => "http://${container_ip}:8091",
aws_access_key_id => $aws_access_key_id,
aws_secret_access_key => $aws_secret_access_key,
email => $email,
csp => "default-src 'self' http: https: ws: wss: data: blob: 'unsafe-inline' 'unsafe-eval'; frame-ancestors 'self';",
port => $port,
}
if $backup_target != '' {
backup::repo { 'zwave':
source => $datadir,
target => $backup_target,
watchdog_url => $backup_watchdog,
password => $backup_password,
environment => $backup_environment,
rclone_config => $backup_rclone,
}
}
}
|