Before you had sent the message back I think we got started along the right path there. I'm sure there are some things we aren't doing correctly, but would appreciate your input to help with this. I think we might have a working prototype soon, and once we get it going, then I think it could potentially be extended to become an extras module. Maybe that's just me being hopeful, but I do think it would be extendable in that manner.
On Saturday, February 18, 2017 at 1:16:05 AM UTC-6, J Hawkesworth wrote: > > Best way to so this is to write a module. This isn't as hard as it might > sound. Have a look at win_environment.ps1 it's only about 30 lines of code. > First bit checks the module parameters and sets up a $results variable, > then the module does its thing and either returns a failure or adds info > the the $results variable and completes, passing the results back to the > ansible controller where they can be registered and used later in your > playbook. > > If you still want to write a script, most likely thing that might be > messing things up is the fact that you need to be aware that PowerShell has > the concept of an output pipe which can contain objects of varying types, > and by default many PowerShell built in functions (also called CmdLets) > default to sending objects to the output pipe. That's why sometimes you > will see > > | Out-Null > > on the ends of some lines of the module code. Thus throws away unwanted > objects and lets you control what is in the output pipe, so that only the > things you need are converted into json to be returned to the ansible > controller. > > Hope this helps, > > Jon > > -- 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/cb2168a0-7d0c-49f4-9633-13a202ed22ef%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
