51b6aea579ba055378b551967e43ff61f2607e1d
[puppet-modules/puppetlabs-apt.git] / manifests / params.pp
1 class apt::params {
2
3   if $caller_module_name and $caller_module_name != $module_name {
4     fail('apt::params is a private class and cannot be accessed directly')
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
15   if $::osfamily != 'Debian' {
16     fail('This module only works on Debian or derivatives like Ubuntu')
17   }
18
19   $config_files = {
20     'conf'   => {
21       'path' => $conf_d,
22       'ext'  => '',
23     },
24     'pref'   => {
25       'path' => $preferences_d,
26       'ext'  => '',
27     },
28     'list'   => {
29       'path' => $sources_list_d,
30       'ext'  => '.list',
31     }
32   }
33
34   $proxy_defaults = {
35     'host'  => undef,
36     'port'  => 8080,
37     'https' => false,
38   }
39
40   $purge_defaults = {
41     'sources.list'   => true,
42     'sources.list.d' => true,
43     'preferences'    => true,
44     'preferences.d'  => true,
45   }
46
47   $file_defaults = {
48     'owner' => 'root',
49     'group' => 'root',
50     'mode'  => '0644',
51   }
52
53   case $::lsbdistid {
54     'ubuntu', 'debian': {
55       $distid = $::lsbdistid
56       $distcodename = $::lsbdistcodename
57     }
58     'linuxmint': {
59       if $::lsbdistcodename == 'debian' {
60         $distid = 'debian'
61         $distcodename = 'wheezy'
62       } else {
63         $distid = 'ubuntu'
64         $distcodename = $::lsbdistcodename ? {
65           'qiana'  => 'trusty',
66           'petra'  => 'saucy',
67           'olivia' => 'raring',
68           'nadia'  => 'quantal',
69           'maya'   => 'precise',
70         }
71       }
72     }
73     '': {
74       fail('Unable to determine lsbdistid, is lsb-release installed?')
75     }
76     default: {
77       fail("Unsupported lsbdistid (${::lsbdistid})")
78     }
79   }
80   case $distid {
81     'ubuntu': {
82       case $distcodename {
83         'lucid': {
84           $ppa_options        = undef
85           $ppa_package        = 'python-software-properties'
86         }
87         'precise': {
88           $ppa_options        = '-y'
89           $ppa_package        = 'python-software-properties'
90         }
91         'trusty', 'utopic', 'vivid': {
92           $ppa_options        = '-y'
93           $ppa_package        = 'software-properties-common'
94         }
95         default: {
96           $ppa_options        = '-y'
97           $ppa_package        = 'software-properties-common'
98         }
99       }
100     }
101   }
102 }