ansible-consul icon indicating copy to clipboard operation
ansible-consul copied to clipboard

Create Dnsmasq configuration fails with `...({{ item.when }}): 'item' is undefined`

Open kmpm opened this issue 1 year ago • 0 comments

On a fresh ubuntu 22.04 I got an error when creating dnsmasq config.

TASK [ansible-community.ansible-consul : Create Dnsmasq configuration] **********************************************************************************************************************************************************
[WARNING]: conditional statements should not include jinja2 templating delimiters such as {{ }} or {% %}. Found: {{ item.when }}
fatal: [hashi1]: FAILED! => {"msg": "The conditional check '{{ item.when }}' failed. The error was: error while evaluating conditional ({{ item.when }}): 'item' is undefined\n\nThe error appears to be in '/home/me/code/ansible-hashicorp/roles/ansible-community.ansible-consul/tasks/dnsmasq.yml': line 31, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Create Dnsmasq configuration\n  ^ here\n"}

Here is my playbook.

#fmt: ansible-playbook
- name: Consul Cluster
  hosts: consul_instances
  any_errors_fatal: true
  become: true
  vars:
    consul_dnsmasq_enable: true
    consul_tls_enable: true
    consul_tls_ca_crt: consul-agent-ca.pem
    consul_tls_server_crt: dc1-server-consul-0.pem
    consul_tls_server_key: dc1-server-consul-0-key.pem
    consul_raw_key: "*****"
  roles:
    - ansible-community.ansible-consul

kmpm avatar Feb 07 '23 10:02 kmpm