首页 > 其他 > 详细

ansible之script模块

时间:2018-03-05 11:00:05      阅读:549      评论:0      收藏:0      [点我收藏+]
例:在所有节点上执行/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

ansible之script模块

原文:http://blog.51cto.com/wujianwei/2082893

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!