- ec2:
key_name: mykey
instance_type: t2.micro
image: ami-123456
wait: yes
group: webserver
count: 3
vpc_subnet_id: subnet-29e63245
assign_public_ip: yes
can it create instances with below names ?
dev-web-01
dev-web-02
dev-web-03
Thanks in advance for any help.
- ec2:
key_name: mykey
instance_type: t2.micro
image: ami-123456
wait: yes
group: webserver
exact_count: 1
count_tags:
Name: "{{ 'dev-web-' + item }}"
instance_tags:
Name: "{{ 'dev-web-' + item }}"
vpc_subnet_id: subnet-29e63245
assign_public_ip: yes
with_sequence: count=3
I too wanted this. In the end I had to do without. It would be awesome if a count variable was exposed for use.
--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6c5bf7dd-4b9c-4ff4-90e5-cf1cee5c609a%40googlegroups.com.
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