The following are the steps for creating Ansible playbooks:
- 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
- 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
-
- Create a file inventory in playbook folder and can be found at https://github.com/PacktPublishing/AWS-Networking-Cookbook.
[root@ansible playbook]# vim inventory ...