Write your first automation task using the VS Code extension
Learn how to write, inspect, debug, and run Ansible playbooks directly within VS Code using Ansible development tools.
Set up the Ansible configuration file Copy linkLink copied!
When you scaffolded your playbook project, an Ansible configuration file, ansible.cfg, was added to the root directory of your project.
Procedure Copy linkLink copied!
/etc/ansible/ansible.cfg, copy any settings that you want to reuse in your project from your default Ansible configuration file to the ansible.cfg file in your project’s root directory.
To learn more about the Ansible configuration file, see Reviewing your Ansible configuration with automation content navigator.
Write your first playbook Copy linkLink copied!
Create your first Ansible playbook within VS Code using the Ansible extension. The tools available help ensure that your syntax is correct and ready to run.
Before you begin Copy linkLink copied!
- You have installed and opened the Ansible VS Code extension.
- You have opened a terminal in VS Code.
- You have installed
ansible-devtools.
Procedure Copy linkLink copied!
Inspect your playbook Copy linkLink copied!
The Ansible VS Code extension provides inline help, syntax highlighting, and assists you with indentation in .yml files.
Procedure Copy linkLink copied!
Debug your playbook Copy linkLink copied!
Learn how to use VS Code to identify and understand error messages in playbooks.


