ansible之script模块
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ansible之script模块相关的知识,希望对你有一定的参考价值。
例:在所有节点上执行/tmp/test.sh1 脚本(该脚本是在ansible 控制节点上的)[[email protected] tmp]# vim test.sh1
#!/bin/sh
Time=
date -s "2016/7/11"
echo "$Time script testing success!"
[[email protected] 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!"
]
}
[[email protected] tmp]# date
Mon Jul 11 00:00:05 CST 2016
[[email protected] tmp]# date
Mon Jul 11 00:00:09 CST 2016
以上是关于ansible之script模块的主要内容,如果未能解决你的问题,请参考以下文章
ansible的安装与介绍host-pattern格式ansible的command模块ansible的shell模块ansible的script模块ansible的copy模块