February 2018
Intermediate to advanced
200 pages
5h 51m
English
We can create a VPC by using an ec2_vpc_net module. This module will take a name, the regions, and a CIDR block as the argument along with our credentials.
- name: Create AWS VPC ec2_vpc_net: name: "{{ vpc_name }}" cidr_block: "{{ vpc_cidr_block }}" region: "{{ aws_region }}" aws_access_key: "{{ access_key }}" aws_secret_key: "{{ secret_key }}" state: present register: my_first_vpc
Note that we have registered the output of the task in a variable called my_first_vpc. We will use values from this variable in the subsequent tasks. We have used quite a few variables as well. Using variables appropriately makes it easier to reuse the roles and playbooks at a later point. Other than access_key and secret_key ...
Read now
Unlock full access