简体   繁体   中英

WIndows PowerShell provisioning script not being executed

I'm deploying a Windows 2012 R2 VSI and need to be able to manage it using Ansible.

I'm using this Ansible sample script ConfigureRemotingForAnsible.ps1 although renamed and have the script hosted on SL Object storage. I specify a postinstall script URL including https (which is supposed to cause the execution of the script after downloading) during the order.

After the Windows VSI is ready I attempt to run a win-ping as follows:

- name: ad1 ready gather_facts: false tags: setup hosts: ad1 tasks: - name: ping the windows vsi win_ping:

This fails with the output:

fatal: [169.55.189.16]: UNREACHABLE! => {"changed": false, "msg": "ssl: HTTPSConnectionPool(host='169.55.189.16', port=5986): Max retries exceeded with url: /wsman (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x107c0b310>: Failed to establish a new connection: [Errno 61] Connection refused',))", "unreachable": true}

If I connect to the system and look in c:\\PostInstall I see my script has been downloaded. If I then open a PowerShell and run the script, I am able to then run the above win-ping successfully.

This tells me that the script is downloaded cleanly and is apparently correct, but is not being executed in spite of the https in the postinstall URL.

I can't find any documentation on requirements of the postinstall script for windows, but I'm wondering if the problem is that I'm using a PowerShell script, and that the post provision process tries to run this in a standard CMD shell.

Does anyone have any ideas or thoughts on what could be wrong?

It should work with powershell succesfully, you should be able to see the logs of the powershell execution in "C:\\postInstallScript.log" perhaps it contains more information about the error.

Anyway if you are still facing this issue I suggest you to open a ticket in Softlayer with "hardware issue" subject, because the issue is likely due to a restriction in the windows machine which is not allowing to execute the script.

Regards

I believe the problem with PowerShell as a provisioning script is the default configuration of PowerShell requires a signed PowerShell script to execute (with no arguments defined). If the PowerShell script is not signed, the execution policy has to be changed on the server, or flags passed to the PowerShell interpreter to allow execution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM