ansible基础命令:
1.远程执行命令
ansible 组名 -m command -a "命令"
2.文件拷贝
ansible ip -m copy -a "src=/etc/passwd dest=/tmp/123"
3.ansible远程执行脚本
cat /tmp/test.sh #!/bin/bash echo `date` > /tmp/ansible_test.txt ansible testhost -m copy -a "src=/tmp/test.sh dest=/tmp/test.sh mode=0755"
4.ansible任务管理计划
ansible testhost -m cron -a "name='test cron' job='/bin/bash /tmp/test.sh' weekday=6"
若要删除该cron只需要加一个字段state=absent。
ansible testhost -m cron -a "name='test cron' state=absent"
5. Ansible安装RPM包/管理服务
ansible testhost -m yum -a "name=包名"
标签:tmp,基础,sh,cron,命令,ansible,test,testhost From: https://www.cnblogs.com/torwen/p/16768396.html