How to Manage and Run Ansible Playbooks Remotely

Visual Studio Code has a feature that allows you to create, modify and run Ansible Playbooks directly on the Ansible Node Linux VM. No need to copy YAML files to run from a VM.

In this article, I will show you step by step how to configure Visual Studio Code to run it on a remote host.


Configuration

1. Open Visual Studio Code and install following extension.

2. Navigate to Remote Explorer and click + next to SSH.

3. Enter SSH connection command.

ssh username@IP_or_hostname

4. Select config file to update.

5. Now click on green connection icon and select Connect to host.

6. Choose your host and type the password.

7. Once connected go to Explorer and click Open folder. Then choose a folder where your Playbooks are located. In my case that is /home/ansible/Desktop/Playbooks/. Click OK. You may be asked for password again.

Now you can create and run Ansible Playbooks directly in an Ansible VM using a remote SSH connection from Visual Studio Code.


Thank you for reading! Here are some links you may be interested in:

Leave a comment

Create a website or blog at WordPress.com

Up ↑