# ansible -i hosts all -m shell -a "sed -i 's/Port 18822/# Port 18822/g' /etc/ssh/sshd_config"
# ansible -i hosts all -m shell -a "sed -i 's/ListenAddress 0.0.0.0/# ListenAddress 0.0.0.0/g' /etc/ssh/sshd_config"
# ansible -i hosts all -m shell -a 'echo "ListenAddress 0.0.0.0:18822" >> /etc/ssh/sshd_config'
# ansible -i hosts all -m shell -a 'echo "ListenAddress 0.0.0.0:22" >> /etc/ssh/sshd_config'
# ansible -i hosts all -m shell -a 'systemctl restart sshd'
网友评论