Deploy Subnets into Different availability zones using Ansible.

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"}'

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.

What happens when you try?

                                      -Josh (jbs@care.com)

This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system.

Hi I can only find all the subnets in the same availability zones which is us-east-1a only. I want each of my subnets into different availability zones in AWS.

Hi I can only find all the subnets in the same availability zones which
is us-east-1a only. I want each of my subnets into different
availability zones in AWS.

Hmm, I don't have any other great ideas, then -- setting the 'az'
parameter in the elements of the 'subnets' list does the right thing when
I try it. (I haven't tried your exact example, but something similar when
I set up a VPC at AWS a while ago.) I did encounter an error where AWS
wouldn't let me create a subnet in a particular AZ (us-east-1c, I think),
but that gave an obvious error, it didn't just drop the subnet into a
different AZ.

                                      -Josh (jbs@care.com)

This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system.

Can you try to use this technique on line#26
https://github.com/arbabnazar/ansible-aws-vpc-ha-wordpress/blob/master/aws/tasks/vpc.yml#L26
For complete reference, check the webserver creation playbook as well.