I only have one script that needs an array as input. This is the only way 
to make the script process dynamic content as I dont wanna call the script 
multple times with other variables. 

Thanks for the link but I dont see any example with an array. 


Den fredag den 27. oktober 2017 kl. 13.13.04 UTC+2 skrev J Hawkesworth:
>
> 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/15f36968-745c-4517-a390-df5361553676%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to