[% USE CSV -%]
[% CSV.dump([ 'Location' 'Device' 'System Name' 'Vendor' 'Model' ]) %]

[% FOREACH row IN results %]
  [% mylist = [] %]
  [% device = row.dns || row.ip %]
  [% FOREACH col IN [ row.location device row.name row.vendor row.model ] %]
    [% mylist.push(col) %]
  [% END %]
  [% CSV.dump(mylist) %]

[% END %]
