Allow for disabling repository configuration
[integration/packaging/puppet-opendaylight.git] / manifests / repos.pp
1 # == Class: opendaylight::repos
2 #
3 # Manages the installation of the OpenDaylight repositories for RedHat and
4 # Debian
5 #
6 # === Parameters
7 #
8 # [*deb_repo*]
9 #  The name of the debppa repo to configure. Ignored if on a RHEL based system.
10 #  Defaults to $::opendaylight::deb_repo
11 #
12 # [*rpm_repo*]
13 #  The name of the rpm repo to configure. Ignored if on a Debian based system
14 #  Defaults to $::opendaylight::rpm_repo
15 #
16 # [*rpm_repo_enabled*]
17 #  Flag to indicate if the the rpm repo should be enabled or disabled.
18 #  Defualts to 1.
19 #
20 # [*rpm_repo_gpgcheck*]
21 #  Flag to indicate if the rpm repo should be configured with gpgcheck.
22 #  Defaults to 0.
23 #
24 class opendaylight::repos (
25   $deb_repo          = $::opendaylight::deb_repo,
26   $rpm_repo          = $::opendaylight::rpm_repo,
27   $rpm_repo_enabled  = 1,
28   $rpm_repo_gpgcheck = 0,
29 ) inherits ::opendaylight {
30   if $::osfamily == 'RedHat' {
31     # Add OpenDaylight's Yum repository
32     yumrepo { $rpm_repo:
33       # 'ensure' isn't supported with Puppet <3.5
34       # Seems to default to present, but docs don't say
35       # https://docs.puppetlabs.com/references/3.4.0/type.html#yumrepo
36       # https://docs.puppetlabs.com/references/3.5.0/type.html#yumrepo
37       baseurl  => "http://cbs.centos.org/repos/nfv7-${rpm_repo}/\$basearch/os/",
38       descr    => 'OpenDaylight SDN Controller',
39       enabled  => $rpm_repo_enabled,
40       # NB: RPM signing is an active TODO, but is not done. We will enable
41       #     this gpgcheck once the RPM supports it.
42       gpgcheck => $rpm_repo_gpgcheck,
43     }
44   } elsif ($::osfamily == 'Debian') {
45     include ::apt
46
47     # Add ODL ppa repository
48     apt::ppa{ $deb_repo: }
49   } else {
50     fail("Unknown operating system method: ${::osfamily}")
51   }
52 }