# Syntax errors when running ansible playbook via VSCode extension

**URL:** <https://forum.ansible.com/t/syntax-errors-when-running-ansible-playbook-via-vscode-extension/40801>\
**Category:** Get Help\
**Tags:** vscode-ansible\
**Created:** [March 5, 2025, 4:11pm UTC](https://forum.ansible.com/t/syntax-errors-when-running-ansible-playbook-via-vscode-extension/40801 "2025-03-05T16:11:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephanie\_Brown](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/stephanie_brown/32/7808_2.png) [@Stephanie\_Brown](https://forum.ansible.com/u/Stephanie_Brown)\
**Post date:** [March 5, 2025, 4:11pm UTC](https://forum.ansible.com/t/syntax-errors-when-running-ansible-playbook-via-vscode-extension/40801/1 "2025-03-05T16:11:53Z")

</div>

[deleted]  
Removing this post

---

<div class="post-metadata">

**Author:** ![kristianheljas](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kristianheljas/32/7702_2.png) [@kristianheljas](https://forum.ansible.com/u/kristianheljas)\
**Post date:** [March 5, 2025, 4:18pm UTC](https://forum.ansible.com/t/syntax-errors-when-running-ansible-playbook-via-vscode-extension/40801/2 "2025-03-05T16:18:29Z")

</div>

The file you are trying to run is not a playbook, its a tasks list.

In vscode, seem to be running an actual playbook, seemingly at `tests/local_setup/main.yml`

Try:

```shell
ansible-playbook /root/dev/repo-name/tests/local_setup/main.yml

```

---

<div class="post-metadata">

**Author:** ![kristianheljas](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kristianheljas/32/7702_2.png) [@kristianheljas](https://forum.ansible.com/u/kristianheljas)\
**Post date:** [March 5, 2025, 4:34pm UTC](https://forum.ansible.com/t/syntax-errors-when-running-ansible-playbook-via-vscode-extension/40801/4 "2025-03-05T16:34:44Z")

</div>

> [@Stephanie\_Brown](#):
>
> Re my second question - do you know if I can run playbooks with an argument either via the command palette or by right clicking on the script \> Run Ansible Playbook via \> Run playbook via ‘ansible playbook’ - or any other method that does not require opening the terminal?

Not sure if you can specify variables by the extension, but there are plenty places you can set such variables:  
See [Using Variables — Ansible Community Documentation](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#where-to-set-variables)

For role, it might make sense to put some sensible default value under `tests/local_setup/roles/validation/defaults/main.yml`.

For more complete list of places to put variables (and their precedence) can be found in the [variable precedence docs](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#understanding-variable-precedence)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [April 4, 2025, 4:38pm UTC](https://forum.ansible.com/t/syntax-errors-when-running-ansible-playbook-via-vscode-extension/40801/6 "2025-04-04T16:38:56Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
