diff options
-rw-r--r-- | manifests/subsystem/apt.pp | 35 | ||||
-rw-r--r-- | templates/apt/Debian.sources.list.erb | 20 |
2 files changed, 39 insertions, 16 deletions
diff --git a/manifests/subsystem/apt.pp b/manifests/subsystem/apt.pp index 002f0c1..28db591 100644 --- a/manifests/subsystem/apt.pp +++ b/manifests/subsystem/apt.pp @@ -1,10 +1,18 @@ class nodo::subsystem::apt( - $ensure = present, - $auto_upgrade = present, - $upgrade_handler = 'apt', - $hour = 2, - $minute = 0, - $mirror = 'https://deb.debian.org', + $ensure = present, + $auto_upgrade = present, + $upgrade_handler = 'apt', + $hour = 2, + $minute = 0, + $mirror = 'https://deb.debian.org', + $contrib = 'enabled', + $non_free = 'enabled', + $non_free_firmware = $::lsbdistcodename ? { + 'wheezy' => 'disabled', + 'buster' => 'disabled', + 'bullseye' => 'disabled', + default => 'enabled', + } ) { package { 'apt-transport-https': ensure => installed, @@ -20,6 +28,21 @@ class nodo::subsystem::apt( content => "Acquire::ForceIPv4 \"true\";\n", } + $contrib_component = $contrib ? { + 'enabled' => ' contrib', + default => '', + } + + $non_free_component = $non_free ? { + 'enabled' => ' non-free', + default => '', + } + + $non_free_firmware_component = $non_free_firmware ? { + 'enabled' => ' non-free-firmware', + default => '', + } + file { '/etc/apt/sources.list': ensure => present, owner => root, diff --git a/templates/apt/Debian.sources.list.erb b/templates/apt/Debian.sources.list.erb index 690bec4..7b54459 100644 --- a/templates/apt/Debian.sources.list.erb +++ b/templates/apt/Debian.sources.list.erb @@ -4,22 +4,22 @@ ### Debian current: <%= scope.lookupvar('::lsbdistcodename') %> # basic -deb <%= @mirror %>/debian/ <%= scope.lookupvar('::lsbdistcodename') %> main contrib non-free non-free-firmware -deb-src https://deb.debian.org/debian/ <%= scope.lookupvar('::lsbdistcodename') %> main contrib non-free non-free-firmware +deb <%= @mirror %>/debian/ <%= scope.lookupvar('::lsbdistcodename') %> main<%= @contrib_component %><%= @non_free_component %><%= @non_free_firmware_component %> +deb-src https://deb.debian.org/debian/ <%= scope.lookupvar('::lsbdistcodename') %> main<%= @contrib_component %><%= @non_free_component %><%= @non_free_firmware_component %> # updates -deb <%= @mirror %>/debian/ <%= scope.lookupvar('::lsbdistcodename') %>-updates main contrib non-free non-free-firmware -deb-src https://deb.debian.org/debian/ <%= scope.lookupvar('::lsbdistcodename') %>-updates main contrib non-free non-free-firmware +deb <%= @mirror %>/debian/ <%= scope.lookupvar('::lsbdistcodename') %>-updates main<%= @contrib_component %><%= @non_free_component %><%= @non_free_firmware_component %> +deb-src https://deb.debian.org/debian/ <%= scope.lookupvar('::lsbdistcodename') %>-updates main<%= @contrib_component %><%= @non_free_component %><%= @non_free_firmware_component %> # security <% if scope.lookupvar('::lsbdistcodename') == 'stretch' or scope.lookupvar('::lsbdistcodename') == 'buster' -%> -deb http://security.debian.org/ <%= scope.lookupvar('::lsbdistcodename') %>/updates main contrib non-free non-free-firmware -deb-src http://security.debian.org/ <%= scope.lookupvar('::lsbdistcodename') %>/updates main contrib non-free non-free-firmware +deb http://security.debian.org/ <%= scope.lookupvar('::lsbdistcodename') %>/updates main<%= @contrib_component %><%= @non_free_component %><%= @non_free_firmware_component %> +deb-src http://security.debian.org/ <%= scope.lookupvar('::lsbdistcodename') %>/updates main<%= @contrib_component %><%= @non_free_component %><%= @non_free_firmware_component %> <% else -%> -deb http://security.debian.org/debian-security <%= scope.lookupvar('::lsbdistcodename') %>-security main contrib non-free non-free-firmware -deb-src http://security.debian.org/debian-security <%= scope.lookupvar('::lsbdistcodename') %>-security main contrib non-free non-free-firmware +deb http://security.debian.org/debian-security <%= scope.lookupvar('::lsbdistcodename') %>-security main<%= @contrib_component %><%= @non_free_component %><%= @non_free_firmware_component %> +deb-src http://security.debian.org/debian-security <%= scope.lookupvar('::lsbdistcodename') %>-security main<%= @contrib_component %><%= @non_free_component %><%= @non_free_firmware_component %> <% end -%> # backports -deb <%= @mirror %>/debian/ <%= scope.lookupvar('::lsbdistcodename') %>-backports main contrib non-free non-free-firmware -deb-src <%= @mirror %>/debian/ <%= scope.lookupvar('::lsbdistcodename') %>-backports main contrib non-free non-free-firmware +deb <%= @mirror %>/debian/ <%= scope.lookupvar('::lsbdistcodename') %>-backports main<%= @contrib_component %><%= @non_free_component %><%= @non_free_firmware_component %> +deb-src <%= @mirror %>/debian/ <%= scope.lookupvar('::lsbdistcodename') %>-backports main<%= @contrib_component %><%= @non_free_component %><%= @non_free_firmware_component %> |