ansible 使用

批量添加ssh免密

ansible mhc -m authorized_key -a "user=root key='{{ lookup('file','/root/.ssh/id_dsa.pub') }}'" -k                                         // -k是询问密码

启动停止系统服务

ansible all  -m systemd -a "name=docker state=started"

ansible all  -m systemd -a "name=docker state=stopped"

原文地址:https://www.cnblogs.com/mhc-fly/p/7577296.html