All the work for creating the underlying network was completed in the previous chapter, meaning that we simply need to copy the elb, gateway, securitygroups, subnets, and vpc folders from your previous playbook across to your current roles folder.
Once copied, update the site.yml file so it reads:
- name: Create and configure an Amazon VPC
hosts: localhost
connection: local
gather_facts: True
vars_files:
- group_vars/common.yml
roles:
- roles/vpc
- roles/subnets
- roles/gateway
- roles/securitygroups
- roles/elb
Also, add the following to the group_vars/common.yml file:
---
# the common variables
environment_name: "wordpress"
ec2_region: "eu-west-1"
Finally, we need to update the subnets that are being created; to do this, update the_subnets variable in roles/subnets/defaults/main.yml to read:
the_subnets:
- { use: 'ec2', az: 'a', subnet: '10.0.10.0/24' }
- { use: 'ec2', az: 'b', subnet: '10.0.11.0/24' }
- { use: 'ec2', az: 'c', subnet: '10.0.12.0/24' }
- { use: 'elb', az: 'a', subnet: '10.0.20.0/24' }
- { use: 'elb', az: 'b', subnet: '10.0.21.0/24' }
- { use: 'elb', az: 'c', subnet: '10.0.22.0/24' }
- { use: 'rds', az: 'a', subnet: '10.0.30.0/24' }
- { use: 'rds', az: 'b', subnet: '10.0.31.0/24' }
- { use: 'efs', az: 'a', subnet: '10.0.40.0/24' }
- { use: 'efs', az: 'b', subnet: '10.0.41.0/24' }
- { use: 'efs', az: 'c', subnet: '10.0.42.0/24' }
As you can see, we are adding an additional subnet for our EFS volume, making it available in all three availability zones. More on why later. However, it does demonstrate the flexibility of our playbook, when all we have to do is add an additional line to our variables to create the additional subnet.
That completes the first part of the playbook; we can now move on to some new territory and launch our Amazon RDS instance.