I am Working on putting subnets into different availability zones with the 
help of ansible. I want to put subnet1 into us-east-1a, then subnet2 into 
us-east-1b and so on. Currently I can only be able to put servers onto 
us-east-1a only. Here is the ansible scripts. 

---
- name: Create AWS VPC and Subnets
  hosts: localhost
  connection: local
  gather_facts: false
  vars:
      region: us-east-1
      prefix: mahela_ansible
      az1: us-east-1a
      az2: us-east-1b
      az3: us-east-1c
 tasks:
 - name: Create VPC
   local_action:
     module: ec2_vpc
     region: "{{ region }}"
     cidr_block: 10.123.0.0/16
     resource_tags: '{"Name":"{{ prefix }}"}'
     subnets:
      - name: Cassandra Subnet
        cidr: 10.123.0.0/24
        az: "{{ az1 }}"
        resource_tags: '{"Name":"{{ prefix }}_cassandra"}'

      - name: MongoDB Subnet
        cidr: 10.123.1.0/24
        az: "{{ az2 }}"
        resource_tags: '{"Name":"{{ prefix }}_Mongodb"}'

      - name: Elastic Search
        cidr: 10.123.2.0/24
        az: "{{ az3 }}"
        resource_tags: '{"Name":"{{ prefix }}_elasticsearch"}'

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9adde32b-82c1-4c24-9089-2b74d5771ded%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to