Deployment validation using Ansible
The AWS collection supports modules to collect information, for example, ec2_vpc_net_info and ec2vpc_subnet_info. This is very useful to retrieve the actual operational information and compare it with the intended data, from host and group vars.
In this recipe, we will use a new playbook, pb_aws_net_validate.yml, adding VPC and subnet validation:
- Create the
pb_aws_net_validate.ymlplaybook, with the playbook definition and the VPC validation tasks. It checks the CIDR block assigned and the name, according to the data inhost_vars:root@cookbook-lab:~/cookbook-lab/chapters/ch08# ansible-playbook pb_aws_net_validate.yml - name: Validate VPC resources hosts: all gather_facts: no environment: AWS_ACCESS_KEY: “{{ aws_access_key }}” AWS_SECRET_KEY: “{{ aws_secret_key_id&...