Creating ansible modules in powershell run on localhost arguments passthrough problem

Skip to first unread message

Martin Siddall

Oct 29, 2021, 9:58:42 AM10/29/21
to Ansible Development
HI all, hoping that someone with a better understanding of the Ansible core product could tell me if what I'm doing is possible using the existing framework or if it would need a development feature request,

We have created an Ansible modue (.ps1 & .py) file structured in the same was as many of the windows modules. But in our header we specify #! /usr/bin/pwsh and the powershell is executed on the localhost using powershell core.

We have a task in a playbook which calls the module and passes paramaters, this module / task is run on the localhost.

The Ansible processes in the most part work fine however when the arguments passed from the module are written into the temp arguments file, they are in some odd text delimited format and not JSON.

I've written a routine for extracting parameters, but I'm going to really struggle when they contain complex data structures such as lists or hash tables.

Is there any way when executing this module the temp file with the arguments can be written into JSON in the same way the windows modules work ?

Could this be done as an action before the module execution in some way ?

The powershell script (.ps1) file currently has a single argument passed to it which is the file path of the temp arguments file.

Any assistance / advice would be appreciated 



Reply all
Reply to author
Message has been deleted
0 new messages