bundles/apt: use node.os and node.os_version to determine settings

This commit is contained in:
Franzi 2020-08-29 21:10:22 +02:00
parent 880184807b
commit b690ae25b0
Signed by: kunsi
GPG key ID: 12E3D2136B818350
3 changed files with 29 additions and 4 deletions

View file

@ -1,6 +1,10 @@
Unattended-Upgrade::Origins-Pattern {
"origin=Debian,codename=${node.metadata['os_release']},label=Debian";
"origin=Debian,codename=${node.metadata['os_release']},label=Debian-Security";
"origin=Debian,codename=${os_release},label=Debian";
"origin=Debian,codename=${os_release},label=Debian-Security";
% if node_has_backports:
"a=${os_release}-backports,n=${os_release}-backports";
% endif
// External packages
% for item in sorted(data.get('origins', set())):

View file

@ -0,0 +1,3 @@
deb http://deb.debian.org/debian/ buster main non-free contrib
deb http://security.debian.org/debian-security buster/updates main contrib non-free
deb http://deb.debian.org/debian/ buster-updates main contrib non-free

View file

@ -1,3 +1,12 @@
supported_os = {
'debian': {
10: 'buster',
},
}
assert supported_os[node.os][node.os_version[0]], '{}: OS {} {} is not supported by bundle:apt'.format(node.name, node.os, node.os_version)
actions = {
'apt_update': {
'command': 'apt-get update',
@ -13,7 +22,11 @@ files = {
'/etc/apt/apt.conf.d/50unattended-upgrades': {
'content_type': 'mako',
'source': 'apt.conf-unattended-upgrades',
'context': {'data': node.metadata.get('apt', {}).get('unattended-upgrades', {})}
'context': {
'data': node.metadata.get('apt', {}).get('unattended-upgrades', {}),
'node_has_backports': ('backports' in node.metadata.get('apt', {}).get('repos', {})),
'os_release': supported_os[node.os][node.os_version[0]],
}
},
'/etc/apt/apt.conf.d/20auto-upgrades': {
'source': 'apt.conf-auto-upgrades',
@ -27,10 +40,15 @@ files = {
'/var/lib/cloud': {
'delete': True,
},
'/etc/apt/sources.list': {
'source': 'sources.list-{}'.format(supported_os[node.os][node.os_version[0]]),
},
}
directories = {
'/etc/apt/sources.list.d': {},
'/etc/apt/sources.list.d': {
'purge': True,
},
}
pkg_apt = {