命令格式
- absible <主机或者分组列表> [选项] //ansible all 就是全部主机
- -M 指定模块路径
- -m 使用模块,默认是command模块
- -a或者--args 模块参数
- -i是inventory文件路径或者可执行脚本
- -k 使用交互式登陆密码
- -e 定义变量
- -v详细信息,-vvvv开启debug模式
ansible all -m command -a "uptime" //如果没有做免密或者配置文件中有用户名和密码会报错
ansible all -m command -a "uptime" -k //不会报错,没有密码会让输入密码
When nothing seems to help, I go look at a stonecutter hammering away at his rock, perhaps a hundred times without as much as a crack showing in it. Yet at the hundred and first blow it will split in two, and I know it was not that blow that did it, but all that had gone before. -- Jacob Riis