known_hosts

This commit is contained in:
cronekorkn 2023-07-28 10:00:16 +02:00
parent 789897acf6
commit 49b05fe8b8
Signed by: cronekorkn
SSH key fingerprint: SHA256:v0410ZKfuO1QHdgKBsdQNF64xmTxOF8osF1LIqwTcVw
2 changed files with 18 additions and 8 deletions

10
hooks/known_hosts.py Normal file
View file

@ -0,0 +1,10 @@
from os.path import expanduser
def apply_start(repo, target, nodes, interactive=False, **kwargs):
with open(expanduser('~/.ssh/known_hosts_ckn'), 'w+') as file:
file.write('\n'.join(sorted(
repo.libs.ssh.known_hosts_entry_for(node)
for node in repo.nodes
if node.has_bundle('ssh')
)))