Have a look at the integration tests here for some examples of how you can 
pass args to the script module:

https://github.com/ansible/ansible/blob/devel/test/integration/targets/win_script/tasks/main.yml

If you have a lot of existing powershell maybe this is the way to go but be 
aware that you aren't really 'going with the grain' if you use ansible just 
as way of delivering a lot of custom powershell to your windows hosts.
It might be all you need of course, but its worth exploring if the existing 
modules and check mode, and the idempotency logic in the existing modules 
have any value for you.

Hope this helps,

Jon

On Friday, October 27, 2017 at 11:56:45 AM UTC+1, [email protected] wrote:
>
> Hi again,
>
> New challenge! 
>
> How do I pass an array or json to a powershell script?
>
>
> - name: Test
>   script: "{{ role_path }}/files/test.ps1 {{ object }}"
>
> Example json:
> {
>     "env01": {
>         "path": "C:\Program Files (x86)\Test"
>     }
> }
>
> Powershell param:
> param(
>     [Parameter(Mandatory = $true)]
>     $object
> )
>
> I tried all kinds of things, but no luck so far. 
>
> What kind of yaml/jinja2 format does the array need to be for powershell 
> to understand is an array object of sorts?
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1c4edd91-61dc-4d32-b422-b8f7dc0d5a8c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to