# 操作步骤 vim /etc/ssh/sshd_config Port 22 Port 51810 service sshd restart # 连接测试 ssh -p 51810 172.17.117.41 # 单个执行 ansible 172.17.117.41 -m shell -a "sed -i '17aPort 22' /etc/ssh/sshd_config" ansible 172.17.117.41 -m shell -a "sed -i '17aPort 51810' /etc/ssh/sshd_config" ansible 172.17.117.41 -m shell -a "service sshd restart" # 批量执行 ansible crawler -m shell -a "sed -i '17aPort 22' /etc/ssh/sshd_config" ansible crawler -m shell -a "sed -i '17aPort 51810' /etc/ssh/sshd_config" ansible crawler -m shell -a "service sshd restart"



