1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
# == Class: openstack_extras::repo::debian::debian
#
# This repo sets up apt sources for use with the debian
# osfamily and debian operatingsystem
#
# === Parameters:
#
# [*release*]
# (optional) The OpenStack release to add a Debian apt source for.
# Defaults to 'flamingo'
#
# [*manage_deb*]
# (optional) Whether or not to add the default Debian APT source
# Defaults to true
#
# [*package_require*]
# (optional) Whether or not to run 'apt-get update' before
# installing any packages.
# Defaults to false
#
# [*use_extrepo*]
# (optional) Should this module use extrepo to
# setup the Debian apt sources.list. If true, the
# below parameters aren't in use.
# Defaults to true.
#
# [*source_hash*]
# (optional) A hash of apt::source resources to
# create and manage
# Defaults to {}
#
# [*source_defaults*]
# (optional) A hash of defaults to use for all apt::source
# resources created by this class
# Defaults to {}
#
# [*deb_location*]
# (optional) Debian package repository location.
# Defaults to "http://${facts['os']['distro']['codename']}-${release}.debian.net/debian"
#
class openstack_extras::repo::debian::debian (
String[1] $release = 'flamingo',
Boolean $manage_deb = true,
Boolean $package_require = false,
Boolean $use_extrepo = true,
# Below params only used if $use_extrepo is set to false
Hash $source_hash = {},
Hash $source_defaults = {},
String[1] $deb_location = "http://${facts['os']['distro']['codename']}-${release}.debian.net/debian",
) {
$lowercase_release = downcase($release)
if $manage_deb {
if $use_extrepo {
# Extrepo is much nicer than what's below, because
# the repositories are authenticated by extrepo itself.
# Also, using apt-key is now deprecated (to be removed in 2021).
# We use ensure_packages to avoid conflict with any other class
# external to this module that may also install extrepo.
# We cannot use package{} or ensure_packages[] as per below,
# because this introduces a dependency loop later on if
# $package_require is set to true.
# So please leave this commented.
#stdlib::ensure_packages(['extrepo',], {'ensure' => 'present'})
exec { "/usr/bin/extrepo enable openstack_${lowercase_release}":
command => "/bin/true # comment to satisfy puppet syntax requirements
apt-get update
apt-get install -y extrepo
extrepo enable openstack_${lowercase_release}
apt-get update
",
logoutput => 'on_failure',
tries => 3,
try_sleep => 1,
creates => "/etc/apt/sources.list.d/extrepo_openstack_${lowercase_release}.sources",
}
if $package_require {
Exec["/usr/bin/extrepo enable openstack_${lowercase_release}"] -> Exec['apt_update']
}
} else {
exec { 'installing openstack-backports-archive-keyring':
command => "/usr/bin/apt-get update ; \
wget ${deb_location}/dists/pubkey.gpg ; \
apt-key add pubkey.gpg ; \
rm pubkey.gpg",
logoutput => 'on_failure',
tries => 3,
try_sleep => 1,
refreshonly => true,
subscribe => File['/etc/apt/sources.list.d/debian-openstack-backports.list'],
notify => Exec['apt_update'],
}
apt::source { 'debian-openstack-backports':
location => $deb_location,
release => "${facts['os']['distro']['codename']}-${lowercase_release}-backports",
repos => 'main',
}
-> apt::source { 'debian-openstack-backports-nochange':
location => $deb_location,
release => "${facts['os']['distro']['codename']}-${lowercase_release}-backports-nochange",
repos => 'main',
}
}
create_resources('apt::source', $source_hash, $source_defaults)
}
if $package_require {
Exec['apt_update'] -> Package<||>
}
}
|