summaryrefslogtreecommitdiff
path: root/manifests/params.pp
blob: 0d205a91a46193ef3f603c1bfed680333c30cdb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#
class unattended_upgrades::params {

  if $::osfamily != 'Debian' {
    fail('This module only works on Debian or derivatives like Ubuntu')
  }

  $default_auto                 = { 'fix_interrupted_dpkg' => true, 'remove' => true, 'reboot' => false, 'clean' => 0, 'reboot_time' => 'now', }
  $default_mail                 = { 'only_on_error'        => true, }
  $default_backup               = { 'archive_interval'     => 0, 'level'     => 3, }
  $default_age                  = { 'min'                  => 2, 'max'       => 0, }
  $default_upgradeable_packages = { 'download_only'        => 0, 'debdelta'  => 1, }
  $default_options              = { 'force_confdef'        => true,
                                    'force_confold'        => true,
                                    'force_confnew'        => false,
                                    'force_confmiss'       => false, }
  # prior to puppet 3.5.0, defined couldn't test if a variable was defined
  # strict variables wasn't added until 3.5.0, so this should be fine.
  if ! $::settings::strict_variables {
    $xfacts = {
      'lsbdistid'           => $::lsbdistid,
      'lsbdistcodename'     => $::lsbdistcodename,
      'lsbmajdistrelease'   => $::lsbmajdistrelease,
      'lsbdistrelease'      => $::lsbdistrelease,
    }
  } else {
    # Strict variables facts lookup compatibility
    $xfacts = {
      'lsbdistid' => defined('$lsbdistid') ? {
        true    => $::lsbdistid,
        default => undef,
      },
      'lsbdistcodename' => defined('$lsbdistcodename') ? {
        true    => $::lsbdistcodename,
        default => undef,
      },
      'lsbmajdistrelease' => defined('$lsbmajdistrelease') ? {
        true    => $::lsbmajdistrelease,
        default => undef,
      },
      'lsbdistrelease' => defined('$lsbdistrelease') ? {
        true    => $::lsbdistrelease,
        default => undef,
      },
    }
  }

  case $xfacts['lsbdistid'] {
    'debian', 'raspbian': {
      case $xfacts['lsbdistcodename'] {
        'squeeze': {
          $legacy_origin       = true
          $origins             =  ['${distro_id} ${distro_codename}-security', #lint:ignore:single_quote_string_with_variables
                                  '${distro_id} ${distro_codename}-lts',] #lint:ignore:single_quote_string_with_variables
        }
        'wheezy': {
          $legacy_origin      = false
          $origins            = [
            'origin=Debian,archive=oldoldstable,label=Debian-Security',
          ]
        }
        'jessie': {
          $legacy_origin      = false
          $origins            = [
            'origin=Debian,archive=oldstable,label=Debian-Security',
          ]
        }
        default: {
          $legacy_origin      = false
          $origins            = ['origin=Debian,codename=${distro_codename},label=Debian-Security',] #lint:ignore:single_quote_string_with_variables
        }
      }
    }
    'ubuntu': {
      case $xfacts['lsbdistcodename'] {
        'precise': {
          $legacy_origin      = true
          $origins            = [
            '${distro_id}:${distro_codename}-security', #lint:ignore:single_quote_string_with_variables
          ]

        }
        'trusty', 'wily': {
          $legacy_origin      = true
          $origins            = [
            '${distro_id}:${distro_codename}-security', #lint:ignore:single_quote_string_with_variables
          ]
        }
        'xenial', 'yakkety': {
          $legacy_origin      = true
          $origins            = [
            '${distro_id}:${distro_codename}', #lint:ignore:single_quote_string_with_variables
            '${distro_id}:${distro_codename}-security', #lint:ignore:single_quote_string_with_variables
          ]
        }
        default: {
          warning("Ubuntu ${xfacts['lsbdistrelease']} \"${xfacts['lsbdistcodename']}\" has reached End of Life - please upgrade!")
          $legacy_origin      = true
          $origins            = [
            '${distro_id}:${distro_codename}-security', #lint:ignore:single_quote_string_with_variables
          ]
        }
      }
    }
    'LinuxMint': {
      case $xfacts['lsbmajdistrelease'] {
        # Linux Mint 13 is based on Ubuntu 12.04
        '13': {
          $legacy_origin      = true
          $origins            = [
            'Ubuntu:precise-security',
          ]
        }
        # Linux Mint 17* is based on Ubuntu 14.04.
        '17': {
          $legacy_origin      = true
          $origins            = [
            'Ubuntu:trusty-security',
          ]
        }
        # Linux Mint 18* is based on Ubuntu 16.04
        '18': {
          $legacy_origin      = true
          $origins            = [
            'Ubuntu:xenial-security',
          ]
        }
        default: {
          $legacy_origin      = true
          $origins            = [
            '${distro_id}:${distro_codename}-security', #lint:ignore:single_quote_string_with_variables
          ]
        }
      }
    }
    default: {
      $legacy_origin = undef
      $origins       = undef
    }
  }
}