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