VS code WSL setup WSL vscode remote - Ansible tutorial Video 3

Опубликовано: 09 Октябрь 2024
на канале: Bizanosa
882
14

VS code WSL setup WSL vscode remote - Ansible tutorial Video 3

Ansible tutorial for beginners notes: https://bizanosa.com/ansible-tutorial...

Recommended VPS Providers : https://bizanosa.com/recommended-vps-...

Visual studio code set up with WSL on Windows.

Video captions:
Here's the corrected YouTube caption:

"In this part, let's set up our environment. We're going to use Visual Studio with WSL. Currently, in our WSL, we have Ubuntu 22.04 installed with Ansible. Typically, in other tutorials, you'll find that when someone is doing the tutorial, they'll create a directory—let's call it 'tuts' for tutorials. Inside this directory, they'll organize files and other directories for their project. We can navigate into that directory and create another directory using 'mkdir'. If you want to create a directory without changing your working directory multiple times, you can use 'mkdir -pB' followed by the directory name, and all the subdirectories will be created. In this case, I've already set it up this way, so I'll just create another directory, and let's call it 'ansible_one' because I'm unsure how many Ansible tutorials I'll be doing.

Inside this main project directory, you might find that someone wants to demonstrate something in the tutorial. Typically, they'll create a file. I'm not sure if Vim is installed, so I'll use VI. In our case, we want to create an inventory file, 'inventory', and I'll use YAML for now. But if you leave it without an extension, it will be assumed to be INI format. So, I'll just enter some example content into the file. Let me copy some text because I don't want to type it all out. This serves as our inventory file. I'll just remove that line.

To save the file, press 'Escape', then type 'dd' to delete the line, and if you want to save it, press 'Shift + ZZ'.

You can perform all these tasks in the terminal, but why do that when you can use Visual Studio? Let me confirm if I have Visual Studio with WSL installed.

If you haven't installed it, you can click on 'Install' here, and it will install. Once installed, you can open it. You can connect to WSL by clicking 'Connect to WSL'.

It will start Visual Studio Code in WSL for the chosen distribution. In my case, I'm using Ubuntu, not Debian, so I'll click on it again and close the remote connection. Then I'll reopen the remote window and click on 'Connect to WSL using distro'.

Here, you can choose the distro you want to use. I'll select 'Ubuntu 22.04', which is already installed. It will install the server, allowing me to write code in Visual Studio Code without relying solely on the WSL command line.

Once the server installation is complete, you can open any file within your chosen distribution. WSL has downloaded the server, and now we need to update it. Let's do that now.

After updating, VS Code will restart, and we'll be in the remote environment. You can see it's running in WSL mode. You can open a folder and navigate to the one you want, or you can click 'Show Local'. However, we want to open a folder connected to the remote. It will display all the folders, including the one we just created using the 'mkdir' command. Let's open that one. This will be our root directory.

Inside, you'll find the inventory file we just created. If you need to run something, you can do it here using the integrated terminal. For example, you can try 'ansible-inventory --list' to list the inventories.

Unfortunately, it won't work until we create an Ansible configuration file. In the configuration file, we'll specify which inventory to use. In this case, we want to use 'inventory'. You can use '-i' to specify the inventory. We'll cover this in more detail later.

That's how you set up Visual Studio Code with WSL. If you need to add folders or files, you can do so within VS Code. You can create new folders or files, and they'll appear here. If you check in the WSL command line using 'ls', you'll see that the folders and files are created there too.

Now that you know how to work with it, if you want to close the connection, simply click here and 'Close Remote Connection'. Let's move on to the next part."

Please consider supporting my channel:
Order services:
Bizanosa WordPress Support Service : https://bizanosa.com/wordpress-suppor...
Bizanosa VPS Support service : https://bizanosa.com/web-server-servi...

Donate:
https://paypal.me/rwahowa

https://www.buymeacoffee.com/bizanosa

***Support My Channel***

If this video was helpful to you, consider supporting my channel : https://paypal.me/rwahowa

I will greatly appreciate your support.

SOCIAL :
Facebook : fb.com/bizanosa
Website : https://bizanosa.com