This commit is contained in:
mwiegand 2021-06-19 01:27:43 +02:00
parent 769de6e1bc
commit 7570b9135b
9 changed files with 72 additions and 1 deletions

View file

@ -1,3 +1,21 @@
from glob import glob
from os.path import join, basename
directories = {
'/etc/apt/sources.list.d': {
'purge': True,
'triggers': {
'action:apt_update',
},
},
}
files = {
'/etc/apt/sources.list': {
'content': '# managed'
},
}
actions = { actions = {
'apt_update': { 'apt_update': {
'command': 'apt-get update', 'command': 'apt-get update',
@ -9,5 +27,27 @@ actions = {
}, },
} }
for name, content in node.metadata.get('apt/sources').items():
files[f'/etc/apt/sources.list.d/{name}.list'] = {
'content': content.format(
release=node.metadata.get('os_release')
),
'triggers': {
'action:apt_update',
},
}
matches = glob(join(repo.path, 'data', 'apt', 'keys', f'{name}.*'))
if matches:
assert len(matches) == 1
files[f'/etc/apt/trusted.gpg.d/{basename(matches[0])}'] = {
'source': matches[0],
'content_type': 'binary',
'triggers': {
'action:apt_update',
},
}
for package, options in node.metadata.get('apt/packages', {}).items(): for package, options in node.metadata.get('apt/packages', {}).items():
pkg_apt[package] = options pkg_apt[package] = options

6
bundles/apt/metadata.py Normal file
View file

@ -0,0 +1,6 @@
defaults = {
'apt': {
'packages': {},
'sources': {},
},
}

View file

@ -24,5 +24,4 @@ defaults = {
'dbuser': 'mailserver', 'dbuser': 'mailserver',
}, },
}, },
} }

0
bundles/gcloud/items.py Normal file
View file

View file

@ -0,0 +1,12 @@
defaults = {
'apt': {
'packages': {
'apt-transport-https': {},
'ca-certificates': {},
'gnupg': {},
},
'sources': {
'gcloud': 'deb https://packages.cloud.google.com/apt cloud-sdk main',
},
},
}

BIN
data/apt/keys/gcloud.gpg Normal file

Binary file not shown.

View file

@ -9,6 +9,7 @@
'postgresql': { 'postgresql': {
'version': '11', 'version': '11',
}, },
'os_release': 'buster',
}, },
'os_version': (10,), 'os_version': (10,),
} }

View file

@ -5,6 +5,18 @@
'bundles': [ 'bundles': [
'apt', 'apt',
], ],
'metadata': {
'apt': {
'sources': {
'debian': '\n'.join([
'deb http://deb.debian.org/debian {release} main non-free contrib',
'deb http://deb.debian.org/debian {release}-updates main contrib non-free',
'deb http://security.debian.org/debian-security {release}/updates main contrib non-free',
'deb http://deb.debian.org/debian {release}-backports main contrib non-free',
]),
},
},
},
'os': 'debian', 'os': 'debian',
'pip_command': 'pip3', 'pip_command': 'pip3',
} }

View file

@ -8,6 +8,7 @@
'dnsserver', 'dnsserver',
], ],
'bundles': [ 'bundles': [
'gcloud',
'wireguard', 'wireguard',
'zfs', 'zfs',
], ],