Merge pull request #867 from eimlav/pdksync_modules-9482
[puppet-modules/puppetlabs-apt.git] / manifests / params.pp
1 # @summary Provides defaults for the Apt module parameters.
2
3 # @api private
4 #
5 class apt::params {
6
7   if $::osfamily != 'Debian' {
8     fail(translate('This module only works on Debian or derivatives like Ubuntu'))
9   }
10
11   $root           = '/etc/apt'
12   $provider       = '/usr/bin/apt-get'
13   $sources_list   = "${root}/sources.list"
14   $sources_list_d = "${root}/sources.list.d"
15   $trusted_gpg_d  = "${root}/trusted.gpg.d"
16   $conf_d         = "${root}/apt.conf.d"
17   $preferences    = "${root}/preferences"
18   $preferences_d  = "${root}/preferences.d"
19   $keyserver      = 'keyserver.ubuntu.com'
20   $confs          = {}
21   $update         = {}
22   $purge          = {}
23   $proxy          = {}
24   $sources        = {}
25   $keys           = {}
26   $ppas           = {}
27   $pins           = {}
28   $settings       = {}
29   $manage_auth_conf = true
30   $auth_conf_entries = []
31
32   $config_files = {
33     'conf'   => {
34       'path' => $conf_d,
35       'ext'  => '',
36     },
37     'pref'   => {
38       'path' => $preferences_d,
39       'ext'  => '.pref',
40     },
41     'list'   => {
42       'path' => $sources_list_d,
43       'ext'  => '.list',
44     }
45   }
46
47   $update_defaults = {
48     'frequency' => 'reluctantly',
49     'loglevel'  => undef,
50     'timeout'   => undef,
51     'tries'     => undef,
52   }
53
54   $proxy_defaults = {
55     'ensure' => undef,
56     'host'   => undef,
57     'port'   => 8080,
58     'https'  => false,
59     'direct' => false,
60   }
61
62   $purge_defaults = {
63     'sources.list'   => false,
64     'sources.list.d' => false,
65     'preferences'    => false,
66     'preferences.d'  => false,
67   }
68
69   $source_key_defaults = {
70     'server'  => $keyserver,
71     'options' => undef,
72     'content' => undef,
73     'source'  => undef,
74   }
75
76   $include_defaults = {
77     'deb' => true,
78     'src' => false,
79   }
80
81   case $facts['os']['name']{
82     'Debian': {
83           $backports = {
84             'location' => 'http://deb.debian.org/debian',
85             'repos'    => 'main contrib non-free',
86           }
87       $ppa_options = undef
88       $ppa_package = undef
89       if versioncmp($facts['os']['release']['major'], '9') >= 0 {
90         $auth_conf_owner = '_apt'
91       } else {
92         $auth_conf_owner = 'root'
93       }
94     }
95     'Ubuntu': {
96       $backports = {
97         'location' => 'http://archive.ubuntu.com/ubuntu',
98         'key'      => '630239CC130E1A7FD81A27B140976EAF437D05B5',
99         'repos'    => 'main universe multiverse restricted',
100       }
101       $ppa_options        = '-y'
102       $ppa_package        = 'software-properties-common'
103       if versioncmp($facts['os']['release']['full'], '16.04') >= 0 {
104         $auth_conf_owner = '_apt'
105       } else {
106         $auth_conf_owner = 'root'
107       }
108     }
109     undef: {
110       fail(translate('Unable to determine value for fact os[\"name\"]'))
111     }
112     default: {
113       $ppa_options = undef
114       $ppa_package = undef
115       $backports   = undef
116       $auth_conf_owner = 'root'
117     }
118   }
119 }