I’m trying to create a Playbook to Shutdown a Windows server. I am aware of win_reboot but that does a Reboot (i.e. shutdown /r) - I want to do shutdown /s to turn a machine completely off. I’ve made a copy of win_reboot.py and changed the Python code so it does a shutdown /s but when I call it, the playbook seems to think it’s a PowerShell command:
“The term ‘/usr/bin/python’ is not recognized as the name of a cmdlet etc…”
I can use the raw module: raw: shutdown /s /t 2 but I’d prefer the variable and error handling of a module.
win_reboot isn’t a module, it’s a Python action that runs on the controller- you have to stick it in an action_plugins dir (not library, as I assume you did, since it looks like it’s trying to run the python code on the Windows target).
I don’t think we’d accept win_shutdown as a discrete module, but I might consider a new “state” arg for win_reboot that defaults to “rebooted” but would accept “shutdown” instead…