How to do it...

The following are the steps for creating Ansible playbooks: 

  1. Create a new playbook. The folder structure will be as follows:
[root@ansible ~ ]# cd /etc/ansible/[root@ansible ansible]# mkdir playbook[root@ansible ansible]# mkdir playbook/roles[root@ansible ansible]# mkdir playbook/roles/vpc[root@ansible ansible]# mkdir playbook/roles/vpc/{defaults,tasks}[root@ansible ansible]# cd playbook
  1. Create the configuration file in the playbook folder awsvpc.yml.
[root@ansible playbook]# vim awsvpc.yml---- name: Create VPC hosts: localhost gather_facts: no roles: - vpc
    1. Create a file inventory in playbook folder and can be found at https://github.com/PacktPublishing/AWS-Networking-Cookbook.
[root@ansible playbook]# vim inventory ...

Get AWS Networking Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.