wip
This commit is contained in:
parent
c075e696fe
commit
1481a99ae0
5 changed files with 29 additions and 3 deletions
11
bundles/hostname/items.py
Normal file
11
bundles/hostname/items.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
files['/etc/hostname'] = {
|
||||||
|
'content': node.metadata.get('hostname'),
|
||||||
|
'triggers': [
|
||||||
|
'action:update_hostname',
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
actions["update_hostname"] = {
|
||||||
|
"command": "hostname -F /etc/hostname",
|
||||||
|
'triggered': True,
|
||||||
|
}
|
14
bundles/hostname/metadata.py
Normal file
14
bundles/hostname/metadata.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
defaults = {
|
||||||
|
'hostname': '.'.join([*reversed(node.name.split('.')), 'ckn', 'li']),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@metadata_reactor.provides(
|
||||||
|
'dns',
|
||||||
|
)
|
||||||
|
def dns(metadata):
|
||||||
|
return {
|
||||||
|
'dns': {
|
||||||
|
metadata.get('hostname'): repo.libs.dns.get_a_records(metadata, external=False),
|
||||||
|
},
|
||||||
|
}
|
|
@ -3,6 +3,7 @@
|
||||||
'all',
|
'all',
|
||||||
],
|
],
|
||||||
'bundles': [
|
'bundles': [
|
||||||
|
'hostname',
|
||||||
'network',
|
'network',
|
||||||
'systemd',
|
'systemd',
|
||||||
'systemd-networkd',
|
'systemd-networkd',
|
||||||
|
|
|
@ -4,10 +4,10 @@ def get_a_records(metadata, internal=True, external=True):
|
||||||
networks = metadata.get('network')
|
networks = metadata.get('network')
|
||||||
|
|
||||||
if not internal:
|
if not internal:
|
||||||
networks.pop('internal')
|
networks.pop('internal', None)
|
||||||
|
|
||||||
if not external:
|
if not external:
|
||||||
networks.pop('external')
|
networks.pop('external', None)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'A': [
|
'A': [
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
bundlewrap>=4.8.0
|
bundlewrap>=4.10.1
|
||||||
pycryptodome
|
pycryptodome
|
||||||
PyNaCl
|
PyNaCl
|
||||||
PyYAML
|
PyYAML
|
||||||
|
|
Loading…
Reference in a new issue