ansible: 服务器初始化时显式开启 ssh 公钥认证

This commit is contained in:
2026-08-18 22:20:23 +08:00
parent eef4881ffd
commit 6f5e3dee55

View File

@@ -80,6 +80,13 @@
line: "PasswordAuthentication no" line: "PasswordAuthentication no"
notify: restart ssh notify: restart ssh
- name: 开启公钥认证
lineinfile:
path: /etc/ssh/sshd_config
regexp: "^#?PubkeyAuthentication"
line: "PubkeyAuthentication yes"
notify: restart ssh
handlers: handlers:
- name: restart ssh - name: restart ssh