# 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'], } }