ansible之script模块

例:在所有节点上执行/tmp/test.sh1 脚本(该脚本是在ansible 控制节点上的)
[root@master tmp]# vim test.sh1
#!/bin/sh
Time=date -s "2016/7/11"
echo “$Time script testing success!”
[root@master tmp]# ansible slave -m script -a “/tmp/test.sh1”
agent.test.com | SUCCESS => {
“changed”: true,
“rc”: 0,
“stderr”: “”,
“stdout”: “Mon Jul 11 00:00:00 CST 2016 script testing success!\r\n”,
“stdout_lines”: [
“Mon Jul 11 00:00:00 CST 2016 script testing success!”
]
}
client02 | SUCCESS => {
“changed”: true,
“rc”: 0,
“stderr”: “”,
“stdout”: “Mon Jul 11 00:00:00 CST 2016 script testing success!\r\n”,
“stdout_lines”: [
“Mon Jul 11 00:00:00 CST 2016 script testing success!”
]
}

[root@client02 tmp]# date
Mon Jul 11 00:00:05 CST 2016
[root@client01 tmp]# date
Mon Jul 11 00:00:09 CST 2016

posted @   勤奋的蓝猫  阅读(2)  评论(0编辑  收藏  举报  
相关博文:
阅读排行:
· DeepSeek “源神”启动!「GitHub 热点速览」
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 我与微信审核的“相爱相杀”看个人小程序副业
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
点击右上角即可分享
微信分享提示