-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.pp
78 lines (76 loc) · 2 KB
/
config.pp
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
75
76
77
78
# @param cfg
# Defines config for daemon
# @param accounts
# Defines "account" settings for all nodes (see "any_sync_accounts" in README.md)
# @param user
# Defines user for daemon files and process
# @param group
# Defines group for daemon files and process
# @param daemon_name
# Defines daemon name
# @param aws_credentials
# Defines credentials for access to s3
# @param syslog_ng
# enable or disable syslog-ng configuration for logging
#
class anysync::filenode::config (
Hash $cfg,
Hash $accounts,
String $user,
String $group,
String $daemon_name,
Hash $aws_credentials,
Boolean $syslog_ng = $::anysync::syslog_ng,
) {
$basedir = dirname($cfg['networkStorePath'])
user { $user:
ensure => present,
shell => '/sbin/nologin',
managehome => true,
}
-> group { $group:
ensure => present,
}
-> file {
"/etc/any-sync-filenode/":
ensure => directory,
;
"/etc/any-sync-filenode/config.yml":
content => template("${module_name}/yaml.erb"),
notify => Service["any-sync-filenode"],
;
[
$basedir,
$cfg['networkStorePath'],
"/home/$user/.aws/",
]:
ensure => directory,
owner => $user,
group => $group,
;
}
$aws_credentials.each |$section, $settings| {
$settings.each |$setting, $value| {
ini_setting { "/home/$user/.aws/credentials_${section}-${setting}":
ensure => $value == undef ? { true => 'absent', default => 'present' },
section => $section,
setting => $setting,
value => $value,
path => "/home/$user/.aws/credentials",
notify => Service["any-sync-filenode"],
require => File["/home/$user/.aws/"],
}
}
}
if $syslog_ng {
syslog_ng::cfg { "any-sync-filenode":
require => File["/etc/any-sync-filenode/config.yml"],
template => "t_short",
}
}
systemd::unit_file { "any-sync-filenode.service":
content => template("${module_name}/service.erb"),
enable => true,
active => true,
}
}