use skip instead of if

This commit is contained in:
mwiegand 2022-03-27 17:02:33 +02:00
parent be6903d3a6
commit 33062c3ec6

View file

@ -1,21 +1,25 @@
if not node.metadata.get('FIXME_dont_touch_sshd', False): # on debian bullseye raspberry images, starting the systemd ssh
# on debian bullseye raspberry images, starting the systemd ssh # daemon seems to collide with an existing sysv daemon
# daemon seems to collide with an existing sysv daemon dont_touch_sshd = node.metadata.get('FIXME_dont_touch_sshd', False),
directories = {
directories = {
'/etc/ssh': { '/etc/ssh': {
'purge': True, 'purge': True,
'mode': '0755', 'mode': '0755',
'skip': dont_touch_sshd,
} }
} }
files = { files = {
'/etc/ssh/moduli': { '/etc/ssh/moduli': {
'content_type': 'any', 'content_type': 'any',
'skip': dont_touch_sshd,
}, },
'/etc/ssh/ssh_config': { '/etc/ssh/ssh_config': {
'triggers': [ 'triggers': [
'svc_systemd:ssh:restart' 'svc_systemd:ssh:restart'
], ],
'skip': dont_touch_sshd,
}, },
'/etc/ssh/ssh_config': { '/etc/ssh/ssh_config': {
'content_type': 'mako', 'content_type': 'mako',
@ -24,6 +28,7 @@ if not node.metadata.get('FIXME_dont_touch_sshd', False):
'triggers': [ 'triggers': [
'svc_systemd:ssh:restart' 'svc_systemd:ssh:restart'
], ],
'skip': dont_touch_sshd,
}, },
'/etc/ssh/sshd_config': { '/etc/ssh/sshd_config': {
'content_type': 'mako', 'content_type': 'mako',
@ -33,6 +38,7 @@ if not node.metadata.get('FIXME_dont_touch_sshd', False):
'triggers': [ 'triggers': [
'svc_systemd:ssh:restart' 'svc_systemd:ssh:restart'
], ],
'skip': dont_touch_sshd,
}, },
'/etc/ssh/ssh_host_ed25519_key': { '/etc/ssh/ssh_host_ed25519_key': {
'content': node.metadata.get('ssh/host_key/private') + '\n', 'content': node.metadata.get('ssh/host_key/private') + '\n',
@ -56,10 +62,11 @@ if not node.metadata.get('FIXME_dont_touch_sshd', False):
and other_node.has_bundle('ssh') and other_node.has_bundle('ssh')
) + '\n', ) + '\n',
}, },
} }
svc_systemd['ssh'] = { svc_systemd['ssh'] = {
'needs': [ 'needs': [
'tag:ssh_users', 'tag:ssh_users',
], ],
} 'skip': dont_touch_sshd,
}