introduce node.metadata['hostname'] to other bundles, update nodefiles to reflect changes
All checks were successful
bundlewrap/pipeline/head This commit looks good
All checks were successful
bundlewrap/pipeline/head This commit looks good
This commit is contained in:
parent
de73552700
commit
831545d8b1
11 changed files with 24 additions and 18 deletions
|
@ -1,7 +1,4 @@
|
||||||
127.0.0.1 localhost ${node.name} ${node.hostname}
|
127.0.0.1 localhost ${node.name} ${node.metadata['hostname']}
|
||||||
% if 'hostname' in node.metadata:
|
|
||||||
127.0.0.1 ${node.metadata['hostname']}
|
|
||||||
% endif
|
|
||||||
|
|
||||||
::1 ip6-localhost
|
::1 ip6-localhost
|
||||||
fe00::0 ip6-localnet
|
fe00::0 ip6-localnet
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
${node.hostname}
|
${node.metadata['hostname']}
|
||||||
|
|
||||||
% for domain, aliases in sorted(node.metadata.get('letsencrypt', {}).get('domains', {}).items()):
|
% for domain, aliases in sorted(node.metadata.get('letsencrypt', {}).get('domains', {}).items()):
|
||||||
${domain} ${' '.join(sorted(aliases))}
|
${domain} ${' '.join(sorted(aliases))}
|
||||||
|
|
|
@ -24,7 +24,7 @@ $TTL 60
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
for rnode in sorted(repo.nodes_in_group('dns')):
|
for rnode in sorted(repo.nodes_in_group('dns')):
|
||||||
ZONE_HEADER += '@ IN NS {}.\n'.format(rnode.metadata.get('powerdns', {}).get('my_hostname', rnode.hostname))
|
ZONE_HEADER += '@ IN NS {}.\n'.format(rnode.metadata.get('powerdns', {}).get('my_hostname', rnode.metadata['hostname']))
|
||||||
|
|
||||||
directories = {
|
directories = {
|
||||||
'/etc/powerdns/pdns.d': {
|
'/etc/powerdns/pdns.d': {
|
||||||
|
|
|
@ -109,9 +109,19 @@ def hosts_entries_for_all_dns_servers(metadata):
|
||||||
entries = {}
|
entries = {}
|
||||||
|
|
||||||
for rnode in repo.nodes_in_group('dns'):
|
for rnode in repo.nodes_in_group('dns'):
|
||||||
entries[rnode.metadata.get('external_ipv4')] = {
|
if rnode.name == node.name:
|
||||||
rnode.metadata.get('powerdns/my_hostname', node.hostname)
|
continue
|
||||||
}
|
|
||||||
|
ip = rnode.metadata.get('external_ipv4')
|
||||||
|
|
||||||
|
if ip:
|
||||||
|
entries[ip] = {
|
||||||
|
rnode.metadata.get('hostname'),
|
||||||
|
rnode.name,
|
||||||
|
}
|
||||||
|
|
||||||
|
if rnode.metadata.get('powerdns/my_hostname', None):
|
||||||
|
entries[ip].add(rnode.metadata.get('powerdns/my_hostname'))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'hosts': {
|
'hosts': {
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
if 'hostname' in node.metadata:
|
|
||||||
hostname = node.metadata['hostname']
|
|
||||||
else:
|
|
||||||
hostname = node.hostname
|
|
||||||
|
|
||||||
actions = {
|
actions = {
|
||||||
'systemd-reload': {
|
'systemd-reload': {
|
||||||
'command': 'systemctl daemon-reload',
|
'command': 'systemctl daemon-reload',
|
||||||
|
@ -13,8 +8,8 @@ actions = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'systemd-hostname': {
|
'systemd-hostname': {
|
||||||
'command': 'hostnamectl set-hostname {}'.format(hostname),
|
'command': 'hostnamectl set-hostname {}'.format(node.metadata['hostname']),
|
||||||
'unless': '[ "$(hostnamectl --static)" = "{}" ]'.format(hostname),
|
'unless': '[ "$(hostnamectl --static)" = "{}" ]'.format(node.metadata['hostname']),
|
||||||
# Provided by 'hostname' bundle
|
# Provided by 'hostname' bundle
|
||||||
'needs': {
|
'needs': {
|
||||||
'file:/etc/hosts',
|
'file:/etc/hosts',
|
||||||
|
|
3
nodes.py
3
nodes.py
|
@ -9,3 +9,6 @@ for node in Path(join(repo_path, "nodes")).rglob("*.py"):
|
||||||
for name, data in nodes.items():
|
for name, data in nodes.items():
|
||||||
if 'hostname' not in data.keys():
|
if 'hostname' not in data.keys():
|
||||||
data['hostname'] = '.'.join(reversed(name.split('.'))) + '.kunbox.net'
|
data['hostname'] = '.'.join(reversed(name.split('.'))) + '.kunbox.net'
|
||||||
|
|
||||||
|
if 'hostname' not in data['metadata'].keys():
|
||||||
|
data['metadata']['hostname'] = '.'.join(reversed(name.split('.'))) + '.kunbox.net'
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# Frankfurt, Germany
|
# Frankfurt, Germany
|
||||||
|
|
||||||
nodes['gce.bind01'] = {
|
nodes['gce.bind01'] = {
|
||||||
|
'hostname': '34.89.208.78',
|
||||||
'bundles': {
|
'bundles': {
|
||||||
'nodejs',
|
'nodejs',
|
||||||
'powerdnsadmin',
|
'powerdnsadmin',
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# Belgium
|
# Belgium
|
||||||
|
|
||||||
nodes['gce.dns02'] = {
|
nodes['gce.dns02'] = {
|
||||||
|
'hostname': '35.187.109.249',
|
||||||
'bundles': set(),
|
'bundles': set(),
|
||||||
'groups': {
|
'groups': {
|
||||||
'dns',
|
'dns',
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# Finland
|
# Finland
|
||||||
|
|
||||||
nodes['gce.dns03'] = {
|
nodes['gce.dns03'] = {
|
||||||
|
'hostname': '35.228.143.71',
|
||||||
'bundles': set(),
|
'bundles': set(),
|
||||||
'groups': {
|
'groups': {
|
||||||
'dns',
|
'dns',
|
||||||
|
|
|
@ -6,7 +6,6 @@ nodes['home.kodi-wohnzimmer'] = {
|
||||||
},
|
},
|
||||||
'groups': set(),
|
'groups': set(),
|
||||||
'metadata': {
|
'metadata': {
|
||||||
'hostname': 'kodi-wohnzimmer',
|
|
||||||
'interfaces': {
|
'interfaces': {
|
||||||
'eth0': {
|
'eth0': {
|
||||||
'ipv4': {
|
'ipv4': {
|
||||||
|
|
|
@ -8,7 +8,6 @@ nodes['home.octoprint-vielschichtigkeit'] = {
|
||||||
'raspberry',
|
'raspberry',
|
||||||
},
|
},
|
||||||
'metadata': {
|
'metadata': {
|
||||||
'hostname': 'octoprint-vielschichtigkeit',
|
|
||||||
'interfaces': {
|
'interfaces': {
|
||||||
'eth0': {
|
'eth0': {
|
||||||
'ipv4': {
|
'ipv4': {
|
||||||
|
|
Loading…
Reference in a new issue