Mercurial > code > home > repos > infra
comparison ssh.py @ 326:5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
author | drewp@bigasterisk.com |
---|---|
date | Mon, 20 Jan 2025 21:55:08 -0800 |
parents | 65e28d2e0cd8 |
children |
comparison
equal
deleted
inserted
replaced
325:4d1b6a6e65d2 | 326:5b88b38f2471 |
---|---|
1 from pyinfra import host | 1 from pyinfra.context import host |
2 from pyinfra.facts.server import LinuxDistribution | 2 from pyinfra.facts.server import LinuxDistribution |
3 from pyinfra.operations import files, systemd | 3 from pyinfra.operations import files, systemd |
4 | |
5 | |
6 systemd.service( | |
7 service='ssh', | |
8 running=True, | |
9 enabled=True, | |
10 ) | |
11 | |
12 files.line(path='/etc/ssh/ssh_config', line="HashKnownHosts", replace="HashKnownHosts no") | |
13 | |
14 if 'pi' not in host.groups: | |
15 files.line(path='/etc/ssh/sshd_config', line="^UseDNS\b", replace="UseDNS no") | |
16 # MAYBE plus needs this fix: adding ListenAddress 0.0.0.0 to /etc/ssh/sshd_config | |
17 systemd.service(service='sshd', reloaded=True) |