什么是Ad-Hocweb
ansible atlanta -a "/sbin/reboot" -f 10
这个命令,atlanta是一个组,这个组里面有不少服务器,"/sbin/reboot" 命令会fork出10个子进程(bash)shell
以并行的方式执行reboot命令。bash
指定用户执行shell命令服务器
ansible atlanta -a "/usr/bin/foo" -u username
使用sudospa
ansible atlanta -a "/usr/bin/foo" -u username --sudo [--ask-sudo-pass]
文件管理命令行
建立文件夹code
ansible webservers -m file -a "dest=/path/to/cmode=755 owner=mdehaan group=mdehaan state=directory"
拷贝文件server
ansible atlanta -m copy -a "src=/etc/hosts dest=/tmp/hosts"