2020-08-29 19:10:22 +00:00
|
|
|
supported_os = {
|
|
|
|
'debian': {
|
|
|
|
10: 'buster',
|
2020-10-09 16:12:49 +00:00
|
|
|
99: 'unstable',
|
2020-08-29 19:10:22 +00:00
|
|
|
},
|
2020-10-03 16:36:29 +00:00
|
|
|
'raspbian': {
|
|
|
|
10: 'buster',
|
|
|
|
},
|
2020-08-29 19:10:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
assert supported_os[node.os][node.os_version[0]], '{}: OS {} {} is not supported by bundle:apt'.format(node.name, node.os, node.os_version)
|
|
|
|
|
|
|
|
|
2020-02-29 14:42:29 +00:00
|
|
|
actions = {
|
|
|
|
'apt_update': {
|
|
|
|
'command': 'apt-get update',
|
2020-08-20 08:59:45 +00:00
|
|
|
'needed_by': {
|
2020-02-29 14:42:29 +00:00
|
|
|
'pkg_apt:',
|
2020-08-20 08:59:45 +00:00
|
|
|
},
|
2020-02-29 14:42:29 +00:00
|
|
|
'triggered': True,
|
|
|
|
'cascade_skip': False,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
files = {
|
|
|
|
'/etc/apt/apt.conf.d/50unattended-upgrades': {
|
|
|
|
'content_type': 'mako',
|
|
|
|
'source': 'apt.conf-unattended-upgrades',
|
2020-08-29 19:10:22 +00:00
|
|
|
'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]],
|
|
|
|
}
|
2020-02-29 14:42:29 +00:00
|
|
|
},
|
2020-03-14 09:37:31 +00:00
|
|
|
'/etc/apt/apt.conf.d/20auto-upgrades': {
|
|
|
|
'source': 'apt.conf-auto-upgrades',
|
|
|
|
},
|
2020-08-20 09:07:18 +00:00
|
|
|
'/etc/cloud': {
|
|
|
|
'delete': True,
|
|
|
|
},
|
|
|
|
'/etc/netplan': {
|
|
|
|
'delete': True,
|
|
|
|
},
|
|
|
|
'/var/lib/cloud': {
|
|
|
|
'delete': True,
|
|
|
|
},
|
2020-08-29 19:10:22 +00:00
|
|
|
'/etc/apt/sources.list': {
|
2020-10-03 16:36:29 +00:00
|
|
|
'source': 'sources.list-{}-{}'.format(node.os, supported_os[node.os][node.os_version[0]]),
|
|
|
|
'triggers': {
|
|
|
|
'action:apt_update',
|
|
|
|
},
|
2020-08-29 19:10:22 +00:00
|
|
|
},
|
2020-02-29 14:42:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
directories = {
|
2020-08-29 19:10:22 +00:00
|
|
|
'/etc/apt/sources.list.d': {
|
|
|
|
'purge': True,
|
2020-10-03 16:36:29 +00:00
|
|
|
'triggers': {
|
|
|
|
'action:apt_update',
|
|
|
|
},
|
2020-08-29 19:10:22 +00:00
|
|
|
},
|
2020-02-29 14:42:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pkg_apt = {
|
|
|
|
'apt-transport-https': {},
|
|
|
|
'unattended-upgrades': {},
|
2020-08-18 13:46:42 +00:00
|
|
|
|
|
|
|
'arping': {},
|
|
|
|
'at': {},
|
2020-10-16 17:12:26 +00:00
|
|
|
'build-essential': {},
|
2020-08-18 13:46:42 +00:00
|
|
|
'bzip2': {},
|
|
|
|
'curl': {},
|
|
|
|
'diffutils': {},
|
|
|
|
'dnsutils': {},
|
2020-10-16 17:12:26 +00:00
|
|
|
'git': {},
|
2020-08-18 13:46:42 +00:00
|
|
|
'grep': {},
|
|
|
|
'gzip': {},
|
|
|
|
'htop': {},
|
|
|
|
'jq': {},
|
|
|
|
'less': {},
|
|
|
|
'logrotate': {},
|
|
|
|
'lsof': {},
|
|
|
|
'mailutils': {},
|
|
|
|
'manpages': {},
|
|
|
|
'molly-guard': {},
|
|
|
|
'moreutils': {},
|
|
|
|
'mount': {},
|
|
|
|
'mtr': {},
|
|
|
|
'ncdu': {},
|
|
|
|
'netcat': {},
|
|
|
|
'nmap': {},
|
|
|
|
'python3': {},
|
2020-10-16 17:14:15 +00:00
|
|
|
'python3-dev': {},
|
2020-09-06 10:04:56 +00:00
|
|
|
'python3-pip': {},
|
|
|
|
'python3-virtualenv': {},
|
2020-08-18 13:46:42 +00:00
|
|
|
'tar': {},
|
|
|
|
'tcpdump': {},
|
|
|
|
'telnet': {},
|
|
|
|
'tmux': {},
|
|
|
|
'tree': {},
|
|
|
|
'unzip': {},
|
|
|
|
'wget': {},
|
|
|
|
'whois': {},
|
|
|
|
'zip': {},
|
2020-08-20 09:07:18 +00:00
|
|
|
|
|
|
|
'cloud-init': {
|
|
|
|
'installed': False,
|
|
|
|
},
|
|
|
|
'netplan.io': {
|
|
|
|
'installed': False,
|
|
|
|
},
|
2020-08-30 09:14:31 +00:00
|
|
|
'popularity-contest': {
|
|
|
|
'installed': False,
|
|
|
|
},
|
2020-02-29 14:42:29 +00:00
|
|
|
}
|
|
|
|
|
2020-08-20 09:07:18 +00:00
|
|
|
|
2020-02-29 14:42:29 +00:00
|
|
|
for name, data in node.metadata.get('apt', {}).get('repos', {}).items():
|
|
|
|
files['/etc/apt/sources.list.d/{}.list'.format(name)] = {
|
|
|
|
'content_type': 'mako',
|
2020-08-30 10:06:19 +00:00
|
|
|
'content': ("\n".join(sorted(data['items']))).format(
|
|
|
|
os=node.os,
|
|
|
|
os_release=supported_os[node.os][node.os_version[0]],
|
|
|
|
),
|
2020-08-20 08:59:45 +00:00
|
|
|
'triggers': {
|
2020-02-29 14:42:29 +00:00
|
|
|
'action:apt_update',
|
2020-08-20 08:59:45 +00:00
|
|
|
},
|
2020-02-29 14:42:29 +00:00
|
|
|
}
|
|
|
|
|
2020-08-20 08:59:45 +00:00
|
|
|
if data.get('install_gpg_key', True):
|
|
|
|
files['/etc/apt/sources.list.d/{}.list'.format(name)]['needs'] = {
|
|
|
|
'file:/etc/apt/trusted.gpg.d/{}.list.asc'.format(name),
|
|
|
|
}
|
2020-02-29 14:42:29 +00:00
|
|
|
|
2020-08-20 08:59:45 +00:00
|
|
|
files['/etc/apt/trusted.gpg.d/{}.list.asc'.format(name)] = {
|
|
|
|
'source': 'gpg-keys/{}.asc'.format(name),
|
|
|
|
'triggers': {
|
|
|
|
'action:apt_update',
|
|
|
|
},
|
|
|
|
}
|
2020-02-29 14:42:29 +00:00
|
|
|
|
|
|
|
if node.metadata.get('apt', {}).get('packages', {}):
|
|
|
|
for package, options in node.metadata['apt']['packages'].items():
|
|
|
|
pkg_apt[package] = options
|