---
- hosts: localhost
  tasks:
   - ec2:
         wait:             yes
         wait_timeout:     300
         assign_public_ip: yes
         image:            "{{ lookup('env', 'AWS_INSTANCE_AMI') }}"
         key_name:         "{{ lookup('env', 'AWS_KEY_NAME') }}"
         instance_type:    "{{ lookup('env', 'AWS_INSTANCE_TYPE') }}"
         instance_tags:
            Name:          "{{ lookup('env', 'AWS_INSTANCE_NAME') }}"
         region:           "{{ lookup('env', 'AWS_REGION') }}"
         aws_access_key:   "{{ lookup('env', 'AWS_ACCESS_KEY_ID') }}"
         aws_secret_key:   "{{ lookup('env', 'AWS_SECRET_ACCESS_KEY') }}"
         vpc_subnet_id:    "{{ lookup('env', 'AWS_SUBNET_ID') }}"
         group_id:         "{{ lookup('env', 'AWS_GROUP_ID') }}"
         count:            "{{ lookup('env', 'AWS_INSTANCE_COUNT') }}"
     register: vmr_instances

   - name: Push template
     template:
        src=./vmr_template.j2
        dest=./VMR-{{item.id}}.cfg
     with_items:
      - "{{ vmr.instances }}"

---
- hosts: localhost
  tasks:
   - ec2:
         wait:             yes
         wait_timeout:     300
         assign_public_ip: yes
         image:            "{{ lookup('env', 'AWS_INSTANCE_AMI') }}"
         key_name:         "{{ lookup('env', 'AWS_KEY_NAME') }}"
         instance_type:    "{{ lookup('env', 'AWS_INSTANCE_TYPE') }}"
         instance_tags:
            Name:          "{{ lookup('env', 'AWS_INSTANCE_NAME') }}"
         region:           "{{ lookup('env', 'AWS_REGION') }}"
         aws_access_key:   "{{ lookup('env', 'AWS_ACCESS_KEY_ID') }}"
         aws_secret_key:   "{{ lookup('env', 'AWS_SECRET_ACCESS_KEY') }}"
         vpc_subnet_id:    "{{ lookup('env', 'AWS_SUBNET_ID') }}"
         group_id:         "{{ lookup('env', 'AWS_GROUP_ID') }}"
         count:            "{{ lookup('env', 'AWS_INSTANCE_COUNT') }}"
     register: vmr_instances

   - name: Push template
     template:
        src=./vmr_template.j2
        dest=./VMR-{{item.id}}.cfg
     with_items:
      - "{{ vmr_instances.instances }}"

Fix typo vmr to vmr_instances
Fix typo vmr to vmr_instances
