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