I am just trying to create 2 or more ec2 instances. I need to assign them static ips and unique tag names. the playbook I created can only do one at a time and I am not sure how to modify it to do multiple
On Sat, Jan 22, 2022 at 9:44 AM Evan Hisey <[email protected]> wrote: > 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 a topic in the > Google Groups "Ansible Project" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/ansible-project/fsQdjZ1Ica8/unsubscribe. > To unsubscribe from this group and all its topics, 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 > <https://groups.google.com/d/msgid/ansible-project/a93bef4c-498a-400f-86db-56af7274dbecn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CALmkhkog%2BD8dobGJgHey7XdR%2Bo1a1xRtw_KZMNr1v0ErgvSQcw%40mail.gmail.com.
