puppet-prod/site/profiles/manifests/puppet/g10k.pp
Ben Vincent 052b07be83 chore: remove excessive comments
- remove the excessive comments and notes at the top of the puppet classes
2024-05-03 20:48:20 +10:00

64 lines
1.8 KiB
Puppet

# Class: profiles::puppet::g10k
#
# This class handles downloading and installation of the g10k tool, a fast
# Git and Forge based Puppet environment and module deployment tool.
# The latest release of g10k is downloaded from GitHub and placed into '/opt/puppetlabs/bin'.
# Additionally, it creates a helper script to easily run g10k with the appropriate configuration.
# It also creates a systemd service and timer that runs the g10k script every minute.
class profiles::puppet::g10k (
String $bin_path,
String $cfg_path,
String $environments_path,
String $default_environment,
){
archive { '/tmp/g10k.zip':
ensure => present,
source => 'https://github.com/xorpaul/g10k/releases/latest/download/g10k-linux-amd64.zip',
extract => true,
extract_path => '/opt/puppetlabs/bin',
creates => '/opt/puppetlabs/bin/g10k',
cleanup => true,
require => Package['unzip']
}
file { '/opt/puppetlabs/bin/puppet-g10k':
ensure => file,
owner => 'root',
group => 'root',
mode => '0755',
content => template('profiles/puppet/g10k/puppet-g10k.erb'),
require => Archive['/tmp/g10k.zip'],
}
$_timer = @(EOT)
[Unit]
Description=puppet-g10k downloader timer
[Timer]
OnCalendar=*:0/1
RandomizedDelaySec=1s
[Install]
WantedBy=timers.target
EOT
$_service = @(EOT)
[Unit]
Description=puppet-g10k downloader service
[Service]
Type=oneshot
ExecStart=/opt/puppetlabs/bin/puppet-g10k
User=root
Group=root
PermissionsStartOnly=false
PrivateTmp=no
EOT
systemd::timer { 'puppet-g10k.timer':
timer_content => $_timer,
service_content => $_service,
active => true,
enable => true,
require => File['/opt/puppetlabs/bin/puppet-g10k'],
}
}