I am looking to start a Go web server (a single .exe) on Windows Server via Ansible.
The equivalent in Linux that works great looks like:
- name: Start web server
become: true
become_user: root
shell:
cmd: nohup /home/centos/webserver </dev/null >/dev/null 2>&1 &
I can do it in PowerShell using Start-Process -FilePath -NoNewWindow .\webserver.exe but it terminates when I close the PowerShell window.
I have also looked into doing it with Start-Job { & C:\Path\to\webserver.exe } and Get-Job shows it completed, but not sure what that means since it's a web server and should just keep running until it's killed.
I need something that will star the webserver but not be tied to the shell so Ansible can do it via the win_shell module. I would have hoped this would work, but no luck:
- name: Start the webserver processes
win_shell: Start-Process -FilePath .\webserver.exe
args:
chdir: C:\Users\Administrator
Any and all suggestions much appreciated!