什麼是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"