ansible实用模块

1.copy本机文件到hosts的node1主机组内各主机。
ansible node1 -m copy -a “src=/home/ecip/mm/mm_shutdown.sh
dest=/home/ecip/mm/ mode=775”
2.在node1组内各主机执行命令
ansible node2 -m shell -a “”
3.更改node1组内各主机文件权限
ansible node1 -m file -a “mode=775 path=/home/ecip/mm/test.tar”
4.本机shell脚本再node1组内各主机执行。
ansible node1 -m script -a “/etc/ansible/cup.sh”
5.在各主机添加定时任务
ansible all -m cron -a ‘name=“ban IP of login” minute=* hour=/2 day= month=* weekday=* job=“sh /data/x5online/ban_try_login_ip.sh”’
6.拉取各主机文件到本机。
ansible -i hosts all -m fetch -a “src=/etc/shadow dest=/home/yonghu/shad/”
7.删除定时任务最后一行
ansible node1 -m shell -a “sed -i ‘$d’ /etc/crontab”

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值