From 2317872c838b99faadf435fcf3d3b00c66c6069c Mon Sep 17 00:00:00 2001 From: Axel Gluth Date: Sun, 22 Nov 2020 21:24:16 +0100 Subject: [PATCH] Update repos before install package --- manifests/init.pp | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 8450c77..18391ba 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -79,10 +79,31 @@ influxdb_service_name => $influxdb_service_name, } - package { $package_names: - ensure => $ensure_package, - require => Class['influxdb::repos'], + case $::operatingsystem { + /(?i:debian|devuan|ubuntu)/: { + package { $package_names: + ensure => $ensure_package, + require => [ + Class['influxdb::repos'], + Exec['apt_update'] + ], + } + } + /(?i:centos|fedora|redhat)/: { + package { $package_names: + ensure => $ensure_package, + require => [ + Class['influxdb::repos'], + Exec['influxdb yum update'] + ], + } + } + default : { + fail("Module ${module_name} \ + is not supported on ${::operatingsystem}") + } } + } else { package { $package_names: