eda6adc93b3e4cd812a88484b7daab9b5db9f673
[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   $file_defaults = {
41     'owner' => 'root',
42     'group' => 'root',
43     'mode'  => '0644',
44   }
45
46   case $::lsbdistid {
47     'ubuntu', 'debian': {
48       $distid = $::lsbdistid
49       $distcodename = $::lsbdistcodename
50     }
51     'linuxmint': {
52       if $::lsbdistcodename == 'debian' {
53         $distid = 'debian'
54         $distcodename = 'wheezy'
55       } else {
56         $distid = 'ubuntu'
57         $distcodename = $::lsbdistcodename ? {
58           'qiana'  => 'trusty',
59           'petra'  => 'saucy',
60           'olivia' => 'raring',
61           'nadia'  => 'quantal',
62           'maya'   => 'precise',
63         }
64       }
65     }
66     '': {
67       fail('Unable to determine lsbdistid, is lsb-release installed?')
68     }
69     default: {
70       fail("Unsupported lsbdistid (${::lsbdistid})")
71     }
72   }
73   case $distid {
74     'ubuntu': {
75       case $distcodename {
76         'lucid': {
77           $ppa_options        = undef
78           $ppa_package        = 'python-software-properties'
79         }
80         'precise': {
81           $ppa_options        = '-y'
82           $ppa_package        = 'python-software-properties'
83         }
84         'trusty', 'utopic', 'vivid': {
85           $ppa_options        = '-y'
86           $ppa_package        = 'software-properties-common'
87         }
88         default: {
89           $ppa_options        = '-y'
90           $ppa_package        = 'software-properties-common'
91         }
92       }
93     }
94   }
95 }