0

I have a variable that is set from a Tower survey and I am using it to retrieve an associated IP address in netbox. I am not able to get it to match when I use square brackets and when I use {{ or ' or " everything is matched and my whole IPAM database is returned.

vars:
    location: "{{ LOCATION }}"
    c_description: "{{CIRCUIT_DESC}}"
    prefix_length: "{{PREFIX}}"
  
  tasks:

  - name: "Print IP"
      debug:
        msg: "{{ query('netbox.netbox.nb_lookup', 'ip-addresses', api_filter= 'description=
              [c_description]', api_endpoint='http://netbox', token='', validate_certs='False') }}"

Here is my output:

TASK [Print IP] ****************************************************************

ok: [localhost] => {
    "msg": []
}
marky23
  • 1
  • 2

1 Answers1

0

Solved in another forum using a tilda:

- name: "Print IP"
  debug:
     msg: "{{ query('netbox.netbox.nb_lookup', 'ip-addresses', api_filter='description=' ~ c_description, 
              api_endpoint='http://netbox.', token='', validate_certs='False') }}"
marky23
  • 1
  • 2