We highly recommend making yourself familiar with Visual Studio Code and the Ansible extension. Even if you’re not planning to use it as your daily driver, it is good to know how it works to explain and show the benefit to customers.
Because your lab was deployed from RHPDS you already have VS Code Server (basically VSCode in a browser) available in your lab environment. You don’t have to install anything locally.
Make sure you can access your VS Code Server instance using the credentials provided.
We found a bug last minute in the blueprint we use for this lab. Please open a terminal in VS Code Server and run this command to make sure “yamllint” and its dependencies are not installed from EPEL:
sudo yum distro-sync --disablerepo=epel -y
Double check you have the latest version of the Ansible extension by Red Hat and remove older or other versions. You might see a “reload” button next to the extension which you need to click to complete the installation.
You can now test the extension by performing the following tasks.
.yml
extension.~/.local/share/code-server/User/settings.json
:"files.associations": {
"*.yml": "ansible",
"*.yaml": "ansible"
},
You’ll see ansible-lint complaining about some parts of the Playbook in the Problems pane. You can open the Problems pane by clicking on View -> Problems. Your job is to fix these issues using the VS Code Ansible extension features.
Ctrl+Click
on a module FQCN to open its documentationCtrl+Space
for module parameters, e.g. add a task calling ansible.builtin.yum
and use Ctrl+Space
to see all module attributes and attribute parametersCtrl+Shift+m
): you might have to make sure ansible-lint
is enabled and notice it is only checking when you save a fileGet familiar with the Ansible VS Code extension features.
Although VSCode of course runs on Linux, Mac and Windows, there are some extra tasks to be done to get Ansible working on Windows or Mac. It’s beyond the scope of this manual to provide detailed instructions on how to setup Podman and Ansible on Windows or Mac.