From 1a904af2ee0ee65b137e2e40edf1e48d76eaeb92 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Sat, 31 May 2025 13:51:51 +1000 Subject: [PATCH] feat: change g10k to use a package (#304) - the archive path is no longer valid - produced a g10k rpm with rpmbuilder Reviewed-on: https://git.query.consul/unkinben/puppet-prod/pulls/304 --- hieradata/roles/infra/puppet/master.yaml | 2 +- site/profiles/manifests/puppet/g10k.pp | 25 +++++++----------------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/hieradata/roles/infra/puppet/master.yaml b/hieradata/roles/infra/puppet/master.yaml index ea51ac8..3f7e584 100644 --- a/hieradata/roles/infra/puppet/master.yaml +++ b/hieradata/roles/infra/puppet/master.yaml @@ -27,7 +27,7 @@ profiles::puppet::cobbler_enc::packages: - 'PyYAML' profiles::puppet::enc::repo: https://git.service.au-syd1.consul/unkinben/puppet-enc.git profiles::puppet::r10k::r10k_repo: https://git.service.au-syd1.consul/unkin/puppet-r10k.git -profiles::puppet::g10k::bin_path: '/opt/puppetlabs/bin/g10k' +profiles::puppet::g10k::bin_path: '/usr/bin/g10k' profiles::puppet::g10k::cfg_path: '/etc/puppetlabs/r10k/r10k.yaml' profiles::puppet::g10k::environments_path: '/etc/puppetlabs/code/environments' profiles::puppet::g10k::default_environment: 'develop' diff --git a/site/profiles/manifests/puppet/g10k.pp b/site/profiles/manifests/puppet/g10k.pp index 3a2af5e..da82166 100644 --- a/site/profiles/manifests/puppet/g10k.pp +++ b/site/profiles/manifests/puppet/g10k.pp @@ -1,25 +1,14 @@ # 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, + Stdlib::Absolutepath $bin_path = '/usr/bin/g10k', + Stdlib::Absolutepath $cfg_path = '/etc/puppetlabs/r10k/r10k.yaml', + Stdlib::Absolutepath $environments_path = '/etc/puppetlabs/code/environments', + String $default_environment = 'develop', ){ - 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'] + package {'g10k': + ensure => 'latest', } file { '/opt/puppetlabs/bin/puppet-g10k': @@ -28,7 +17,7 @@ class profiles::puppet::g10k ( group => 'root', mode => '0755', content => template('profiles/puppet/g10k/puppet-g10k.erb'), - require => Archive['/tmp/g10k.zip'], + require => Package['g10k'], } $_timer = @(EOT)