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
|
# File 'manifests/component/redis.pp', line 4
class complyadm::component::redis (
Complyadm::Config::Comply_redis $config,
) {
$container = $config['container']
complyadm::runtime::volume { 'redis':
ensure => 'present',
runtime => $container['runtime'],
}
$redis_env = '/etc/puppetlabs/comply/redis.env'
file { $redis_env:
ensure => file,
owner => 'root',
group => 'root',
seltype => 'container_file_t',
show_diff => false,
content => epp('complyadm/comply_env.epp', {
env_vars => $container['env_vars'],
}),
notify => Complyadm::Runtime::Run[$container['name']],
}
$healthcheck_file = "/etc/puppetlabs/comply/${container['name']}-healthcheck.sh"
file { $healthcheck_file:
ensure => file,
owner => 'root',
group => 'root',
mode => '+x',
seltype => 'container_file_t',
show_diff => false,
content => epp('complyadm/runtime/service-watchdog.epp', { healthcheck => "${container['runtime']} exec ${container['name']} ${container['healthcheck']}" }),
notify => Complyadm::Runtime::Run[$container['name']],
}
complyadm::runtime::run { $container['name']:
runtime => $container['runtime'],
install_runtime => $container['install_runtime'],
image => $container['image'],
net => $container['net'],
extra_parameters => $container['extra_parameters'],
after_create => $healthcheck_file,
extra_systemd_parameters => $container['extra_systemd_parameters'],
ports => $container['ports'],
pull_on_start => false,
cmd => $container['cmd'],
volumes => ['redis:/data'],
env_file => [$redis_env],
require => [
Complyadm::Runtime::Volume['redis'],
File[$redis_env],
File[$healthcheck_file],
],
}
}
|