I would say you are 95% done. You are just missing a loop and list of
lists. Looking at the snippet, I think you may be making life a touch more
difficult than needed. Are you writing a role or a playbook? What is your
programing/ansible experience level? I see a similar mistakes in other
emails you have posted, so trying to gauge answer level, as what you seem
to be doing is while not advanced, also not trivial as it requires a decent
understanding of aws, lists, ansible and the limits of loops.
On Friday, January 21, 2022 at 8:28:46 AM UTC-6 [email protected] wrote:
> hi
>
> any idea how I can create multiple ec2 instances and tag it
>
> main.yml
>
> - include_vars: vars/main.yml
> - name: create the ec2 instance
> ec2:
> assign_public_ip: no
> group_id: '{{ deploy_env.sg_group }}'
> instance_type: "{{ deploy_env.instance_type }}"
> image: "{{ deploy_env.image }}"
> wait: true
> wait_timeout: 600
> count: 10
> region: "{{ deploy_env.region }}"
> vpc_subnet_id: "{{ deploy_env.vpc_subnet_id}}"
> private_ip: "{{ deploy_env.assign_ip }}"
> instance_tags:
> Name: "{{ deploy_env.instance_tags.name }}"
>
> ---------------------------
>
> how do i put the names in my var file?
>
> deploy_env:
> instance_type: t2.micro
> image: ami-02d03ce209db75523
> sg_group:
> - "sg-057771872265bfda6"
> region: us-west-1
> assign_ip: 10.10.1.10
> vpc_subnet_id: subnet-0d9d37440a2265163
> instance_tags:
> name: test1
>
>
> ----------------
>
>
> I need to apply ip address 10.10.1.11 - 10.10.1.20 and different tags to
> the ec2 instances
>
>
>
>
>
>
>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/a93bef4c-498a-400f-86db-56af7274dbecn%40googlegroups.com.