Compare commits

..

4 commits

Author SHA1 Message Date
mwiegand
7570b9135b wip 2021-06-19 01:27:43 +02:00
mwiegand
769de6e1bc wip 2021-06-18 19:13:57 +02:00
mwiegand
d77d2e6b1e wip 2021-06-18 19:01:33 +02:00
mwiegand
13444f1f33 wip 2021-06-18 18:59:48 +02:00
12 changed files with 97 additions and 2 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 = {
'apt_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():
pkg_apt[package] = options

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

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

View file

@ -0,0 +1,12 @@
$TTL 600
@ IN SOA ns.sublimity.de. admin.sublimity.de. (
2020080302 ;Serial
1200 ;Refresh
600 ;Retry
1209600 ;Expire
600 ;Negative response caching TTL
)
% for record in records:
${record[0].ljust(max_name)} IN ${record[1].ljust(max_type)} ${record[2]}
% endfor

View file

@ -0,0 +1,8 @@
# for zone, records in node.metadata.get('bind/zones').items():
# files[f'/var/lib/bind/{zone}'] = {
# 'source': 'zonefile',
# 'content_type': 'mako',
# 'context': {
# 'records': records,
# }
# }

View file

@ -1,4 +1,9 @@
defaults = {
'apt': {
'packages': {
'bind9': {},
},
},
'bind': {
'zones': {},
},
@ -12,7 +17,6 @@ def collect_records(metadata):
zones = metadata.get('bind/zones')
for other_node in repo.nodes:
print(other_node.name)
for fqdn, records in other_node.metadata.get('dns').items():
matching_zones = sorted(
filter(

View file

@ -24,5 +24,4 @@ defaults = {
'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': {
'version': '11',
},
'os_release': 'buster',
},
'os_version': (10,),
}

View file

@ -5,6 +5,18 @@
'bundles': [
'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',
'pip_command': 'pip3',
}

View file

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