diff --git a/manifests/repo/apt.pp b/manifests/repo/apt.pp index 4f7b5d2f7..641099ec7 100644 --- a/manifests/repo/apt.pp +++ b/manifests/repo/apt.pp @@ -15,7 +15,13 @@ Class['rabbitmq::repo::apt'] -> Package<| title == 'rabbitmq-server' |> + $ensure_repo = $rabbitmq::manage_repos ? { + false => 'absent', + default => 'present', + } + apt::source { 'rabbitmq': + ensure => $ensure_repo, location => $location, release => $release, repos => $repos, diff --git a/manifests/repo/rhel.pp b/manifests/repo/rhel.pp index daa994224..4ae751701 100644 --- a/manifests/repo/rhel.pp +++ b/manifests/repo/rhel.pp @@ -2,13 +2,15 @@ # Imports the gpg key if it doesn't already exist. class rabbitmq::repo::rhel { - $package_gpg_key = $rabbitmq::package_gpg_key + if $rabbitmq::manage_repos { - Class['rabbitmq::repo::rhel'] -> Package<| title == 'rabbitmq-server' |> + $package_gpg_key = $rabbitmq::package_gpg_key - exec { "rpm --import ${package_gpg_key}": - path => ['/bin','/usr/bin','/sbin','/usr/sbin'], - unless => 'rpm -q gpg-pubkey-056e8e56-468e43f2 2>/dev/null', - } + Class['rabbitmq::repo::rhel'] -> Package<| title == 'rabbitmq-server' |> + exec { "rpm --import ${package_gpg_key}": + path => ['/bin','/usr/bin','/sbin','/usr/sbin'], + unless => 'rpm -q gpg-pubkey-056e8e56-468e43f2 2>/dev/null', + } + } }