ansible命令行操作

遠程批量執行命令:
ansible all -m shell -a " ls -al /tmp/"
遠程批量創建文件、目錄:(目錄)state=directory (文件)state=touch、(刪除)state=absent
ansible all -m file -a "path=/tmp/test state=directory  owner=root group=root mode=600 "
遠程批量文件複製:
ansible all -m copy-a "src=/tmp/text.txt dest=/tmp/text.txt"
遠程批量安裝服務:
ansible all -m yum-a "name=httpd state=present/install/remove"

遠程批量啓動服務:
ansible all -m service -a "name=httpd state=started/stopped/restarted"

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章