9a9257702a2732dcb6750d8b535f4fe645f4a1da
[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 $facts['os']['family'] != '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_force   = false
15   $sources_list_d       = "${root}/sources.list.d"
16   $trusted_gpg_d        = "${root}/trusted.gpg.d"
17   $conf_d               = "${root}/apt.conf.d"
18   $preferences          = "${root}/preferences"
19   $preferences_d        = "${root}/preferences.d"
20   $apt_conf_d           = "${root}/apt.conf.d"
21   $keyserver            = 'keyserver.ubuntu.com'
22   $key_options          = undef
23   $confs                = {}
24   $update               = {}
25   $purge                = {}
26   $proxy                = {}
27   $sources              = {}
28   $keys                 = {}
29   $ppas                 = {}
30   $pins                 = {}
31   $settings             = {}
32   $manage_auth_conf     = true
33   $auth_conf_entries    = []
34
35   $config_files = {
36     'conf'   => {
37       'path' => $conf_d,
38       'ext'  => '',
39     },
40     'pref'   => {
41       'path' => $preferences_d,
42       'ext'  => '.pref',
43     },
44     'list'   => {
45       'path' => $sources_list_d,
46       'ext'  => '.list',
47     }
48   }
49
50   $update_defaults = {
51     'frequency' => 'reluctantly',
52     'loglevel'  => undef,
53     'timeout'   => undef,
54     'tries'     => undef,
55   }
56
57   $proxy_defaults = {
58     'ensure'     => undef,
59     'host'       => undef,
60     'port'       => 8080,
61     'https'      => false,
62     'https_acng' => false,
63     'direct'     => false,
64   }
65
66   $purge_defaults = {
67     'sources.list'   => false,
68     'sources.list.d' => false,
69     'preferences'    => false,
70     'preferences.d'  => false,
71     'apt.conf.d'     => false,
72   }
73
74   $source_key_defaults = {
75     'server'  => $keyserver,
76     'options' => undef,
77     'content' => undef,
78     'source'  => undef,
79   }
80
81   $include_defaults = {
82     'deb' => true,
83     'src' => false,
84   }
85
86   case $facts['os']['name']{
87     'Debian': {
88           $backports = {
89             'location' => 'http://deb.debian.org/debian',
90             'repos'    => 'main contrib non-free',
91           }
92       $ppa_options = undef
93       $ppa_package = undef
94       if versioncmp($facts['os']['release']['major'], '9') >= 0 {
95         $auth_conf_owner = '_apt'
96       } else {
97         $auth_conf_owner = 'root'
98       }
99     }
100     'Ubuntu': {
101       $backports = {
102         'location' => 'http://archive.ubuntu.com/ubuntu',
103         'key'      => '630239CC130E1A7FD81A27B140976EAF437D05B5',
104         'repos'    => 'main universe multiverse restricted',
105       }
106       $ppa_options        = '-y'
107       $ppa_package        = 'software-properties-common'
108       if versioncmp($facts['os']['release']['full'], '16.04') >= 0 {
109         $auth_conf_owner = '_apt'
110       } else {
111         $auth_conf_owner = 'root'
112       }
113     }
114     undef: {
115       fail(translate('Unable to determine value for fact os[\"name\"]'))
116     }
117     default: {
118       $ppa_options = undef
119       $ppa_package = undef
120       $backports   = undef
121       $auth_conf_owner = 'root'
122     }
123   }
124 }