Massimiliano (Max)
10/01/2024, 11:54 AM$os_major = $facts['os']['release']['major']
$repo_base = '<http://repositories.geant.org>'
$splunk_version = lookup('splunk_universalforwarder_version', String, 'first', '8.0.1')
$splunk_build = lookup('splunk_universalforwarder_build', String, 'first', '6db836e2fb9e')
if $facts['os']['family'] == 'RedHat' {
if $facts['os']['distro']['release']['major'] == '6' {
$package_suffix = '-linux-2.6-x86_64.rpm'
$splunk_user = 'splunk'
} else {
$package_suffix = '.x86_64.rpm'
$splunk_user = 'splunkfwd'
}
$package_name = "splunkforwarder-${splunk_version}-${splunk_build}${package_suffix}"
$source_url = "${repo_base}/yum/centos-${os_major}/geant_yum/${package_name}"
$package_version = "${splunk_version}-${splunk_build}"
$pin_version = $package_version
$manage_package_source = false
} elsif $facts['os']['family'] == 'Debian' {
$splunk_user = 'splunkfwd'
$package_name = "splunkforwarder-${splunk_version}-${splunk_build}-linux-2.6-amd64.deb"
$source_url = "${repo_base}/deb/ubuntu-${os_major}/geant_deb/pool/main/s/splunkforwarder/${package_name}"
$package_version = 'latest'
$pin_version = $splunk_version
$manage_package_source = true
}
I was expecting a parameter to use my own repository and end of story.spp
10/01/2024, 3:04 PMsplunk_universalforwarder_version and splunk_universalforwarder_build . Could you not have a splunk_universalforwarder_user that get set to 'splunkfwd' in common.yaml and to 'splunk' in data/OS/RedHat/6.yaml? It seems like almost everything else could also be built up from hiera lookups, rather than programmatic logic.Massimiliano (Max)
10/01/2024, 3:11 PMuse_custom_repo, and then I only need to push the deb and rpm file to my repository.
Otherwise the module starts fetching from Splunk using the puppet archive, extracts the file, copy a file onto a staging directory, install it from there ... it's convoluted, with no or little gain. And I'm not mentioning all the variables that have been implemented to build the repository string....
What I would like to achieve is:
1. use a custom Yum, Apt repository
2. use puppet package resource, instead of doing dpkg -i ... ...
3. eventually, on top of that I could use my own pin_package module: <https://forge.puppet.com/modules/maxadamo/pin_package/readme>