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"

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