Hmm, that might work. I need to spread the instances over the availability 
zones so I have been setting up something like:

    instances:
      - {subnet: "{{vpc_subnet.private.a}}", count: 3 }
      - {subnet: "{{vpc_subnet.private.b}}", count: 3 }
      - {subnet: "{{vpc_subnet.private.c}}", count: 3 }
      - {subnet: "{{vpc_subnet.private.d}}", count: 1 }


    - name: Create instances
      ec2:
        image: "{{ubuntu_image.ami}}"
        region: "{{ec2_region}}"
        vpc_subnet_id: "{{item.subnet.id}}"
        instance_type: "{{api_proxy_instance_type}}"
        assign_public_ip: false
        group: "{{security_groups}}"
        instance_tags:
          Name: "{{env_prefix}}{{instance_name}}"
          api_proxy: group
          subnet: "{{item.subnet.id}}"
          env: "{{env}}"
          managed_by: ansible
        exact_count: "{{item.count}}"
        count_tag:
          api_proxy: group
          subnet: "{{item.subnet.id}}"
        key_name: "{{aws_key_name}}"
        wait: yes
      register: ec2_proxy
      with_items: instances



I looks like using with sequence and (item % 4) to select the availability 
zone would then leave the {{item}} to be used a suffix.

I will have to try this. Thanks Benno!

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/cd1e2423-2b1f-4a4f-a7c5-e9324d634cb0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to