How to loop over this local_fact in Ansible?

You could do something like this

   - set_fact:
       profiles_dicts: |
         {% set res = -%}
         {% for key, value in ansible_local.was.profiles.iteritems() -%}
           {% set ignored = res.extend([{'Server': key, 'ENV':value.env}]) -%}
         {%- endfor %}
         {{ res }}