actions = { 'apt_update': { 'command': 'apt-get update', 'needed_by': { 'pkg_apt:', }, 'triggered': True, 'cascade_skip': False, }, } 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', {})} }, '/etc/apt/apt.conf.d/20auto-upgrades': { 'source': 'apt.conf-auto-upgrades', }, '/etc/cloud': { 'delete': True, }, '/etc/netplan': { 'delete': True, }, '/var/lib/cloud': { 'delete': True, }, } directories = { '/etc/apt/sources.list.d': {}, } pkg_apt = { 'apt-transport-https': {}, 'unattended-upgrades': {}, 'arping': {}, 'at': {}, 'bzip2': {}, 'curl': {}, 'diffutils': {}, 'dnsutils': {}, 'grep': {}, 'gzip': {}, 'htop': {}, 'jq': {}, 'less': {}, 'logrotate': {}, 'lsof': {}, 'mailutils': {}, 'manpages': {}, 'molly-guard': {}, 'moreutils': {}, 'mount': {}, 'mtr': {}, 'ncdu': {}, 'netcat': {}, 'nmap': {}, 'python3': {}, 'tar': {}, 'tcpdump': {}, 'telnet': {}, 'tmux': {}, 'tree': {}, 'unzip': {}, 'wget': {}, 'whois': {}, 'zip': {}, 'cloud-init': { 'installed': False, }, 'netplan.io': { 'installed': False, }, } for name, data in node.metadata.get('apt', {}).get('repos', {}).items(): files['/etc/apt/sources.list.d/{}.list'.format(name)] = { 'content_type': 'mako', 'content': "\n".join(data['items']), 'triggers': { 'action:apt_update', }, } 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), } files['/etc/apt/trusted.gpg.d/{}.list.asc'.format(name)] = { 'source': 'gpg-keys/{}.asc'.format(name), 'triggers': { 'action:apt_update', }, } if node.metadata.get('apt', {}).get('packages', {}): for package, options in node.metadata['apt']['packages'].items(): pkg_apt[package] = options