introduce node.metadata['hostname'] to other bundles, update nodefiles to reflect changes
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2020-10-25 11:07:23 +01:00
parent de73552700
commit 831545d8b1
Signed by: kunsi
GPG key ID: 12E3D2136B818350
11 changed files with 24 additions and 18 deletions

View file

@ -1,7 +1,4 @@
127.0.0.1 localhost ${node.name} ${node.hostname}
% if 'hostname' in node.metadata:
127.0.0.1 ${node.metadata['hostname']}
% endif
127.0.0.1 localhost ${node.name} ${node.metadata['hostname']}
::1 ip6-localhost
fe00::0 ip6-localnet

View file

@ -1,4 +1,4 @@
${node.hostname}
${node.metadata['hostname']}
% for domain, aliases in sorted(node.metadata.get('letsencrypt', {}).get('domains', {}).items()):
${domain} ${' '.join(sorted(aliases))}

View file

@ -24,7 +24,7 @@ $TTL 60
)
"""
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 = {
'/etc/powerdns/pdns.d': {

View file

@ -109,9 +109,19 @@ def hosts_entries_for_all_dns_servers(metadata):
entries = {}
for rnode in repo.nodes_in_group('dns'):
entries[rnode.metadata.get('external_ipv4')] = {
rnode.metadata.get('powerdns/my_hostname', node.hostname)
}
if rnode.name == node.name:
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 {
'hosts': {

View file

@ -1,8 +1,3 @@
if 'hostname' in node.metadata:
hostname = node.metadata['hostname']
else:
hostname = node.hostname
actions = {
'systemd-reload': {
'command': 'systemctl daemon-reload',
@ -13,8 +8,8 @@ actions = {
},
},
'systemd-hostname': {
'command': 'hostnamectl set-hostname {}'.format(hostname),
'unless': '[ "$(hostnamectl --static)" = "{}" ]'.format(hostname),
'command': 'hostnamectl set-hostname {}'.format(node.metadata['hostname']),
'unless': '[ "$(hostnamectl --static)" = "{}" ]'.format(node.metadata['hostname']),
# Provided by 'hostname' bundle
'needs': {
'file:/etc/hosts',