92 lines
2.5 KiB
Puppet
92 lines
2.5 KiB
Puppet
## puppet_cd::r10k::install.pp
|
|
# Module name: puppet_cd
|
|
# Author: Arne Teuke (arne_teuke@confdroid)
|
|
# @summary Class manages r10k installation for the puppet_cd module.
|
|
###############################################################################
|
|
class puppet_cd::r10k::install (
|
|
|
|
) inherits puppet_cd::params {
|
|
if ($pt_pm_fqdn == $fqdn) and ($pt_use_r10k == true) {
|
|
# enable CRB
|
|
exec { 'enable_crb':
|
|
command => 'dnf config-manager --set-enabled crb',
|
|
unless => 'dnf repolist --disabled | grep -qE "crb|CodeReady"',
|
|
path => ['/usr/bin', '/bin'],
|
|
}
|
|
|
|
# install required packages
|
|
package { $pt_r10k_pkg:
|
|
ensure => $pt_pkg_ensure,
|
|
before => Package['r10k'],
|
|
require => Exec['enable_crb'],
|
|
}
|
|
|
|
# install r10k via gem
|
|
package { 'r10k':
|
|
ensure => $pt_pkg_ensure,
|
|
provider => gem,
|
|
require => Package[$pt_r10k_pkg],
|
|
}
|
|
|
|
# create r10k dir
|
|
file { 'r10k_dir':
|
|
ensure => directory,
|
|
path => $pt_r10k_dir,
|
|
owner => 'root',
|
|
group => 'root',
|
|
mode => '0755',
|
|
selrange => s0,
|
|
selrole => object_r,
|
|
seltype => puppet_etc_t,
|
|
seluser => unconfined_u,
|
|
}
|
|
|
|
# configure r10k.yaml
|
|
file { $pt_r10k_file:
|
|
ensure => file,
|
|
owner => 'root',
|
|
group => 'root',
|
|
mode => '0644',
|
|
selrange => s0,
|
|
selrole => object_r,
|
|
seltype => puppet_etc_t,
|
|
seluser => unconfined_u,
|
|
require => File['r10k_dir'],
|
|
content => template($pt_r10k_erb),
|
|
}
|
|
|
|
if $pt_use_r10k_webhook == true {
|
|
package { $pt_r10k_webhook_pkg:
|
|
ensure => present,
|
|
provider => gem,
|
|
require => Package[$pt_r10k_pkg],
|
|
}
|
|
|
|
exec { 'create symlink':
|
|
command => $pt_webhook_link,
|
|
creates => '/usr/bin/r10k_gitlab_webhook',
|
|
path => ['/bin', '/usr/bin'],
|
|
require => Package[$pt_r10k_webhook_pkg],
|
|
}
|
|
|
|
file { $pt_webhook_service_file:
|
|
ensure => file,
|
|
owner => 'root',
|
|
group => 'root',
|
|
mode => '0644',
|
|
selrange => s0,
|
|
selrole => object_r,
|
|
seltype => puppet_etc_t,
|
|
seluser => unconfined_u,
|
|
content => template($pt_webhook_service_erb),
|
|
notify => [Service[$pt_r10k_webhook_service],Exec['systemctl-daemon-reload']],
|
|
}
|
|
|
|
exec { 'systemctl-daemon-reload':
|
|
command => '/bin/systemctl daemon-reload',
|
|
refreshonly => true,
|
|
}
|
|
}
|
|
}
|
|
}
|