{{ foo }} Should be written as “{{ foo }}”

There are many reason for this ansible error.

I have found it to be something with the yml, obvious.

But also if you have a specified parameters with wrong upper / lowercase name from the parameter that is referenced in the jinja yml file.

…… and try to pass to –extra-vars parameter in a playbook.

Example

Code for removing it

- hosts: localhost
  connection: local
  tasks:
    - name: Deleting resource group - "{{ name }}"
      azure_rm_resourcegroup:
        name: "{{ name }}"
        state: absent
        force_delete_nonempty: true
      register: rg
    - debug:
        var: rg

ansible-playbook delete_main.yml --extra-vars "Name=ResoureGroup2"

The Name is wrong here in the parameter, it should be name

Runt it again

ansible-playbook delete_main.yml --extra-vars "name=ResoureGroup2"

Now it ran, but did not do anything, that is because ResoureGroup2 does not exists.

ResourceGroup2 does exists, run it again.

ansible-playbook delete_main.yml --extra-vars "name=ResourceGroup2

Now it takes more time and it is deleting all resources in the resource group.

Scroll to Top