Mercurial > code > home > repos > infra
annotate ssh.py @ 279:1cb4aeec8fc6
pi_setup code to prepare a pi for netboot
author | drewp@bigasterisk.com |
---|---|
date | Sun, 14 Apr 2024 20:54:35 -0700 |
parents | 4e424a144183 |
children | 65e28d2e0cd8 |
rev | line source |
---|---|
12 | 1 from pyinfra import host |
2 from pyinfra.facts.server import LinuxDistribution | |
3 from pyinfra.operations import files, systemd | |
4 | |
5 is_pi = host.get_fact(LinuxDistribution)['name'] in ['Debian', 'Raspbian GNU/Linux'] | |
6 | |
7 systemd.service( | |
8 service='ssh', | |
9 running=True, | |
10 enabled=True, | |
11 ) | |
12 | |
13 files.line(path='/etc/ssh/ssh_config', line="HashKnownHosts", replace="HashKnownHosts no") | |
14 | |
98
3d4340fbb16c
finish moving these lines from system.py
drewp@bigasterisk.com
parents:
12
diff
changeset
|
15 if not is_pi: |
3d4340fbb16c
finish moving these lines from system.py
drewp@bigasterisk.com
parents:
12
diff
changeset
|
16 files.line(path='/etc/ssh/sshd_config', line="^UseDNS\b", replace="UseDNS no") |
237 | 17 # MAYBE plus needs this fix: adding ListenAddress 0.0.0.0 to /etc/ssh/sshd_config |
98
3d4340fbb16c
finish moving these lines from system.py
drewp@bigasterisk.com
parents:
12
diff
changeset
|
18 systemd.service(service='sshd', reloaded=True) |