Help with Looping

Good Evening team,

I need help with ansible looping during Dynatrace API call for creating multiple management zones.

Here is code below

  • name: “create management zone”
    uri:
    url: “{{ dt_config_api_endpoint }}managementZones/{{ dt_mz_64id }}?Api-Token={{ dt_api_token }}”
    method: PUT
    body:
    id: “{{ dt_mz_64id }}”
    name: “{{ item.name }}”
    rules:
  • type: CUSTOM_DEVICE
    enabled: true
    propagationTypes:
    conditions:
  • key:
    attribute: CUSTOM_DEVICE_TAGS
    comparisonInfo:
    type: “TAG”
    operator: EQUALS
    value:
    key: “ApplicationID”
    context: “CONTEXTLESS”
    value: “{{ item.dt_tag_value }}”
    negate: false
    body_format: json
    status_code: 201
    return_content: yes
    loop: “{{ dt_mz_name }}”
    register: new_mz

Variable file where list of management zones along with tags number is
dt_mz_name:

  • name: “PRODUCTION STANDBY”
    dt_tag_value: 111111111 }
  • name: “BENTLEYProduction”
    dt_tag_value: 222222222 }
  • name: “PEVIProduction”
    dt_tag_value: 33333333}

Now when I ran playbook. It only create first management zones with tag and job then failed.

Any help

Are the winged brackets in the list of items part of the value?
I can only think it may interfere with the processing of the runbook.

Maybe do something like dt_tag_value: “222222222 }” if they need to be part of it.

were you able to resolve this?