Ansible has modules shell, for executing commands against Linux targets, and win_shell for executing commands against Windows targets - typically using PowerShell. So I was curious to see if it was possible to execute commands in a Linux target using PowerShell Core and if so, how to do it.
For my test I have an Ubuntu 18.04 VM with PowerShell Core 6.2.2 installed:
The shell module has an executable parameter described as “Change the shell used to execute the command.
Back Story Back in January 2017 Craig and I made PowervRA available for macOS and Linux via PowerShell Core. It was always our intention to do the same thing for PowervRO and , although slightly later than we hoped, we’re finally able to do that. PowerShell Core has come a long way itself over the last year, currently in Release Candidate and soon to be GA, and I’m sure a lot of the hard work and community feedback which has gone into that has helped make the job of PowervRO supporting PowerShell Core very straightforward.
This article on the vCOTeam site details how to mount a CIFS share on the vRO Appliance so that workflows can write files directly to a Windows File Share rather than using another process to copy the file over there.
This was straightforward to implement in a lab scenario, however within a corporate environment with more restrictions around security and networking it can potentially be more of a challenge. Specifically we encountered the following error response from a Windows Server seemingly configured correctly for Share and NTFS permssions on the folder to mount:
Back Story For a while Craig and I have had a number of requests regarding offering OS X and Linux support to PowervRA, particularly since in case you weren’t aware PowerShell is now available on those OSs and 3rd party modules such as PowerCLI are heading towards supporting that. We first looked at offering this support for PowervRA when the first Alpha release of PowerShell Core was shipped, however we were blocked by a couple of issues, particularly this one regarding certificate checking.
I needed to setup a Minecraft server so that one of my kids could play online against a friend who had moved to another continent and they wanted a few different ways to stay in touch. Since one half of the friendship doesn’t have Xbox Live, but both have the PC / Mac version I figured I could sort out a hosted server for them to play on. There are plenty of places around that will host one for you for a small fee, but since I had some monthly Windows Azure credits via my MSDN subscription I figured I’d have a go setting up my own one and see how that went.
A question I’ve fielded now and again in the past, “Can I use PowerShell to access Linux servers?”. Among others, there were a few answers I could give of varying degrees of usefulness depending on the requirements:
Use the command line tool plink.exe Look at OMI I was recently asked this again at my current workplace and discovered a project I hadn’t seen previously, a PowerShell module based on the SSH.