Discussion:
[ansible-project] Run Powershell script on remote
Dimitri Yioulos
2015-07-22 16:55:41 UTC
Permalink
Apologies for what must be a very dumb question, but how do I run a
Powershell script which is located on a remote Windows machine? And, can I
run a script that's located on the Ansible host?

Many thanks!
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/bea720c6-0e54-4753-a9a9-dfdef79a86ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
J Hawkesworth
2015-07-22 20:20:09 UTC
Permalink
You can use the 'raw' module to run a powershell script that is already on
the remote machine (or any exe), and you can use the 'script' module to
have ansible transfer the powershell script from your ansible controller to
your managed host and then run the powershell script.

If possible though, use the windows modules for controlling your Windows
machines (or create your own), they integrate better with the rest of
ansible (you can take control of whether ansible returns 'ok' or 'changed'
with your own module).

If you are able to clone ansible from github there are many useful examples
of using raw, script and other windows modules in the
test/integration/roles/ dirs

Hope this helps,

Jon
Post by Dimitri Yioulos
Apologies for what must be a very dumb question, but how do I run a
Powershell script which is located on a remote Windows machine? And, can I
run a script that's located on the Ansible host?
Many thanks!
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2efadc9e-05b9-43bd-a2d1-173d4f4701b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dimitri Yioulos
2015-07-23 13:16:28 UTC
Permalink
Thank you, Jon. I really appreciate the many contributions that you make
to the list!
Post by Dimitri Yioulos
Apologies for what must be a very dumb question, but how do I run a
Powershell script which is located on a remote Windows machine? And, can I
run a script that's located on the Ansible host?
Many thanks!
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/81350686-ee83-44ca-b76a-70276a4819e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...