简体   繁体   中英

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) . Is it possible? If not is there any alternative to do so?

Take a look at this section Windows Support

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. See example below — it is assumed that run.bat file is saved in /tmp (not a best practice) directory on your control server.

- name: execute batch
  script: /tmp/run.bat

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM