-
Notifications
You must be signed in to change notification settings - Fork 130
/
Copy pathsetup_acceptance_node.pp
47 lines (41 loc) · 1.09 KB
/
setup_acceptance_node.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
class { 'foreman::repo':
repo => 'nightly',
}
# This provides dig which we use in our tests
$dig_package = $facts['os']['family'] ? {
'Debian' => 'dnsutils',
default => 'bind-utils',
}
package { $dig_package:
ensure => installed,
}
# Needed for the Ansible plugin
if $facts['os']['name'] == 'CentOS' {
package { 'centos-release-ansible-29':
ensure => present,
}
}
# Create certificates
$certificate_group = 'foreman-proxy'
$directory = '/etc/foreman-proxy'
$certificate = "${directory}/certificate.pem"
$key = "${directory}/key.pem"
group { $certificate_group:
ensure => present,
}
exec { 'Create certificate directory':
command => "mkdir -p ${directory}",
path => ['/bin', '/usr/bin'],
creates => $directory,
}
-> exec { 'Generate certificate':
command => "openssl req -nodes -x509 -newkey rsa:2048 -subj '/CN=${facts['networking']['fqdn']}' -keyout '${key}' -out '${certificate}' -days 365",
path => ['/bin', '/usr/bin'],
creates => $certificate,
umask => '0022',
}
-> file { [$key, $certificate]:
owner => 'root',
group => $certificate_group,
mode => '0640',
}