[英]Run a batch file in windows using ansible
I want to run a run.bat file present on my remote windows node using my control node (CentOS) . 我想使用我的控制节点(CentOS)运行远程Windows节点上的run.bat文件。 Is it possible?
可能吗? If not is there any alternative to do so?
如果没有,有没有其他选择吗?
Take a look at this section Windows Support 请查看本节Windows支持
So what you want to do is create a task that looks similar to this: 所以你想要做的是创建一个类似于这个的任务:
- name: run simple script
script: run.bat
Save the script (the batch file) on the control server. 将脚本(批处理文件)保存在控制服务器上。 Ansible copies the script to the remote host and then execute it there.
Ansible将脚本复制到远程主机,然后在那里执行。 See example below — it is assumed that
run.bat
file is saved in /tmp
(not a best practice) directory on your control server. 请参阅下面的示例 - 假设
run.bat
文件保存在控制服务器上的/tmp
(不是最佳实践)目录中。
- name: execute batch
script: /tmp/run.bat
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.