[% USE CSV -%]
[% CSV.dump(['Device','Location','System Name','Model','OS Version','Management IP','Serial','First Seen','Last Discovered']) %]

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

[% END %]
