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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
# File 'manifests/akrr/config.pp', line 3
class xdmod::akrr::config {
$akrr_home = $xdmod::_akrr_home
$akrr_user_home = $xdmod::_akrr_user_home
file { "${akrr_home}/cfg":
ensure => 'directory',
owner => $xdmod::akrr_user,
group => $xdmod::akrr_user_group,
mode => '0700',
}
file { 'akrr.inp.py':
ensure => 'file',
path => "${akrr_home}/cfg/akrr.inp.py",
source => "${akrr_home}/setup/scripts/akrr.src.inp.py",
replace => false,
owner => $xdmod::akrr_user,
group => $xdmod::akrr_user_group,
mode => '0600',
}
Xdmod::Akrr::Setting {
before => Exec['akrrgenerate_tables.py'],
}
xdmod::akrr::setting { 'xd_db_host': value => $xdmod::database_host }
xdmod::akrr::setting { 'xd_db_user': value => $xdmod::akrr_database_user }
xdmod::akrr::setting { 'xd_db_passwd': value => $xdmod::akrr_database_password }
xdmod::akrr::setting { 'akrr_db_user': value => $xdmod::akrr_database_user }
xdmod::akrr::setting { 'akrr_db_passwd': value => $xdmod::akrr_database_password }
xdmod::akrr::setting { 'restapi_rw_password': value => $xdmod::akrr_restapi_rw_password }
xdmod::akrr::setting { 'restapi_ro_password': value => $xdmod::akrr_restapi_ro_password }
xdmod::akrr::setting { 'default_task_params': value => '{\'test_run\': False}', quote => false }
$_akrr_x509_key = "${akrr_home}/cfg/server.key"
$_akrr_x509_cert = "${akrr_home}/cfg/server.cert"
$_akrr_cert_command = [
'openssl req -new -newkey rsa:4096',
'-days 365 -nodes -x509',
"-subj '/CN=${facts['networking']['fqdn']}'",
"-keyout ${_akrr_x509_key}",
"-out ${_akrr_x509_cert}",
]
exec { 'akrr-cert':
cwd => $xdmod::_akrr_home,
path => '/usr/bin:/bin:/usr/sbin:/sbin',
user => $xdmod::akrr_user,
command => join($_akrr_cert_command, ' '),
creates => [$_akrr_x509_key, $_akrr_x509_cert],
before => Concat['akrr-server-cert'],
require => File["${akrr_home}/cfg"],
}
concat { 'akrr-server-cert':
ensure => 'present',
path => "${akrr_home}/cfg/server.pem",
owner => $xdmod::akrr_user,
group => $xdmod::akrr_user_group,
before => Exec['akrrgenerate_tables.py'],
}
concat::fragment { 'akrr-server.key':
target => 'akrr-server-cert',
source => $_akrr_x509_key,
order => '01',
}
concat::fragment { 'akrr-server.cert':
target => 'akrr-server-cert',
source => $_akrr_x509_cert,
order => '02',
}
if $xdmod::akrr_cron_mailto {
$_akrr_cron_environment = "MAILTO=${xdmod::akrr_cron_mailto}"
} else {
$_akrr_cron_environment = undef
}
if $xdmod::manage_akrr_cron {
cron { 'akrr-restart':
command => "${akrr_home}/bin/restart.sh",
user => $xdmod::akrr_user,
minute => '50',
hour => '23',
}
cron { 'akrr-checknrestart':
command => "${akrr_home}/bin/checknrestart.sh",
user => $xdmod::akrr_user,
minute => '33',
}
}
shellvar { 'AKRR_HOME':
ensure => 'exported',
target => "${akrr_user_home}/.bashrc",
value => $xdmod::_akrr_home,
}
shellvar { 'akrr-PATH':
ensure => 'exported',
target => "${akrr_user_home}/.bashrc",
variable => 'PATH',
value => "${akrr_home}/bin:\$PATH",
}
exec { 'akrrgenerate_tables.py':
cwd => $xdmod::_akrr_home,
path => '/usr/bin:/bin:/usr/sbin:/sbin',
user => $xdmod::akrr_user,
command => 'python ./setup/scripts/akrrgenerate_tables.py && touch ./cfg/.akrrgenerate_tables',
creates => "${akrr_home}/cfg/.akrrgenerate_tables",
}
}
|