]> gitweb.fluxo.info Git - puppet-nodo.git/commitdiff
Fix: apt: manage /etc/apt/preferences
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 8 Aug 2024 01:18:47 +0000 (22:18 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 8 Aug 2024 01:18:47 +0000 (22:18 -0300)
manifests/subsystem/apt.pp
templates/apt/Debian.preferences.erb [new file with mode: 0644]

index d2d531d2309dae4a419156d30cd735c1f1143a69..2dcbc265f03086388ac6027d9ce273522de73c9a 100644 (file)
@@ -57,6 +57,18 @@ class nodo::subsystem::apt(
     },
   }
 
+  file { '/etc/apt/preferences':
+    ensure  => present,
+    owner   => root,
+    group   => root,
+    mode    => '0644',
+    require => [ File['/etc/apt/apt.conf.d/1000-force-ipv4-transport'], Package['apt-transport-https'] ],
+    content => $ensure ? {
+      'present' => template("nodo/apt/${::operatingsystem}.preferences.erb"),
+       default  => undef,
+    },
+  }
+
   # We have /var/log/dpkg.log, so we do not need to rotate /var/log/upgrade.log
   $log = ">> /var/log/upgrade.log 2>&1"
   $apt = '/usr/bin/apt-get'
diff --git a/templates/apt/Debian.preferences.erb b/templates/apt/Debian.preferences.erb
new file mode 100644 (file)
index 0000000..63729ff
--- /dev/null
@@ -0,0 +1,27 @@
+# This file is managed by puppet
+# all local modifications will be overwritten
+
+Explanation: Debian <%= scope.lookupvar('::lsbdistcodename') %>
+Package: *
+Pin: release o=Debian,n=<%= scope.lookupvar('::lsbdistcodename') %>
+Pin-Priority: 990
+
+Explanation: Debian <%= scope.lookupvar('::lsbdistcodename') %>-updates
+Package: *
+Pin: release o=Debian,n=<%= scope.lookupvar('::lsbdistcodename') %>-updates
+Pin-Priority: 990
+
+Explanation: Debian <%= scope.lookupvar('::lsbdistcodename') %>-security
+Package: *
+Pin: release o=Debian,n=<%= scope.lookupvar('::lsbdistcodename') %>-security
+Pin-Priority: 990
+
+Explanation: Debian sid
+Package: *
+Pin: release o=Debian,n=sid
+Pin-Priority: 1
+
+Explanation: Debian fallback
+Package: *
+Pin: release o=Debian
+Pin-Priority: -10