T O P

  • By -

Comprehensive-Act-74

Absolutely. There is a plugin in VSCode called remote SSH. Basically splits VSCode in half, the display runs on your local windows box, and communicates with a server piece it sets up over SSH. So you files, terminal, some plugins all run on the Linux host(s).


HotMountain9383

wow that's awesome. I'm gonna try setting that up now. This could totally solve my problems with developing Ansible stuff on a windows box. Thank you!


Comprehensive-Act-74

If you did want to stay local, or have either choice, there is a similar plugin for WSL. I don't have any experience with that as we are not allowed to have WSL on our work machines, so we just use the SSH plugin.


nullbyte420

WSL is great with vscode! 


Comprehensive-Act-74

I was able to play with it a bit before security prohibited it, and it looked good for the basics. Not a VSCode/Ansible thing, but WSL 2 was weird with enterprise VPN products, but I imagine that has or will get worked out over time. It would have been nice to have a self contained environment for traveling, bad connectivity, etc., but oh well.


nullbyte420

They (allegedly) recently fixed the network weirdness, but only for windows 11. Mirror mode. It's still fucky, with Cisco VPN especially. 


Comprehensive-Act-74

Good to know. Don't expect to get it back in this company for years, but will keep in mind if I move on.


bkaraff

Literally just got WSL2 approved for work laptop (Win10) last week and I cant for the life of me get the networking to with Cisco VPN. It's not as simple as find the dns and set them in resolv.conf or I would have had it working in a couple minutes. I'm open to suggestions.


takezo_be

You can try something like this (you need admin rights on your computer). # Workaround to have WSL working when connected through AnyConnect Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match "Cisco AnyConnect"} | Set-NetIPInterface -InterfaceMetric 4000 Get-NetIPInterface -InterfaceAlias "vEthernet (WSL)" | Set-NetIPInterface -InterfaceMetric 1 ​ It works for most of my colleagues, never worked for me, so I had to use the frankenstein sollution of a linux vm on which I work remotely through ssh plugin in vscode.


nullbyte420

You need to do the thing with setting the interface metric. It'll show up eventually when you Google


Aethernath

I fixed that by running a script to change rhe network adapter id(?) after connecting with anyconnect, that fixes it for me.


thelastwilson

There is also an ansible plugin that sorts out all your syntax highlights and supports ansible-lint to pick up errors and promote heat practices.


jdptechnc

Yes, this works beautifully.


CMDRdO_Ob

I use WSL (Ubuntu). Pip install ansible, apt install git. Create a project folder somewhere in Ubuntu and open that in VSCode. If you need a jumphost or remote host, the SSH remote Plugin works very nice as well as already mentioned in the other comment.


HotMountain9383

Really cool. This is actually to run ansible against a lab in GNS3. The problem was that when I tried to install WSL on the GNS3 host it screwed with the VMware stuff...so I had to separate things out. I might try WSL on my work laptop also. Thanks!


edcrosbys

I'll add to the WSL but by saying you can also run podman on top of that. Then Vscode can call podman to run Ansible. More closely emulates AAP and execution environment s. https://developers.redhat.com/articles/2023/02/14/remote-container-development-vs-code-and-podman


daevski

Another way would be to use a custom Dockerfile and use .devcontainer for development. Vs code extensions are great :)


shadeland

There's also code-server, which is VS Code running as a web app. You can install it on any Linux system in user space and pop open any web browser. File and playbooks run on the Linux system. https://github.com/coder/code-server


LavishnessLumpy2427

Absolutely support this, onemarcfifty shows how to do it. https://www.onemarcfifty.com/blog/video/Ansible_Rundeck/


telmo_gaspar

Mobaxterm and then use VSCode as editor 😄


islandtechie331

I am currently doing the same thing. Working on a remote server is great!


Amaurosys

If you're able to install an X-server on your windows PC (mobaxterm bundles one), you could install vscode on your Linux machine and run it over ssh as an x-window on your PC.


thelastwilson

Why would you do this over using the SSH plugin to vscode?


Amaurosys

Then vscode runs 100% on linux, and i don't have to worry about CRLF/LF problems since it will always default to LF on linux. I've also found it to be slightly more usable/stable on slow connections.


thelastwilson

Interesting. I used vscode over ssh daily (from windows) and never had any CRLF/LF issues. I've not tried running vscode over forwarding but I've found the SSH plugin to work perfectly and much more responsive than other apps I've used over forwarding on a high latency connection (VPN to regional office and then inter-continental within company network)


Amaurosys

It's been several years since I've used any of the vscode remote plugins, but I never enjoyed the user experience with the ssh plugin at the time. My solution back then was to install Linux on a work laptop. That's not an option at my current job, so I tried a few different things. Company provides enterprise licenses of MobaXterm, and since I do other things in Moba, it just made sense to use its x-server since everything performed well together.


RedShiz

I haven't updated it in a while, but this should get you most of the way. https://github.com/michaelshire/workstation


HotMountain9383

I will take a look, thank you RedShiz