---
vars:
  vlan:
    vlan_id: "{{ item.vlan_id }}"
    name: "{{ item.name }}"
    desc: "{{ item.desc }}"
    interface: "{{ item.intf }}"
    enabled: "{{ item.state.get('inactive') != 'inactive' }}"
    state: "{% if item.state.get('inactive') == 'inactive'%}inactive{% else %}active{% endif %}"

keys:
  vlans:
    type: list
    value: "{{ vlan }}"
    top: configuration/vlans/vlan
    items:
      vlan_id: vlan-id
      name: name
      desc: description
      intf: interface/name
      state: ".[@inactive='inactive']"
    when: item.name == 'test-5'
