Step 1 - Ansible Playbooks

Ansible calls it's configuration and orchestration framework "playbooks" and is a collections of "play(s)" or tasks for configuration management and deployment to a device or multiple devices in a synchronous or asynchronous fashion. While playbooks can be represented as a single file, Ansible best practices recommend a particular directory structure for playbooks that we'll be building below. This directory structure lets you organize files into smaller configuration files for better reuse, particularly into "roles." Roles in are Ansible are a way to automatically load certain variables, tasks, etc depending on a categorization. A role can be defined for example by device type. Before creating the configuration tasks using Ansible modules, lets create the appropriate directory structure.

cd ~/ltrdcn-3225/ansible
mkdir -p playbooks/aci/group_vars
mkdir -p playbooks/aci/roles

Step 2 - Initialize Ansible APIC via Galaxy

We're going to use Ansible Galaxy to create our roles within the roles directory. Ansible Galaxy is the official community for downloading or creating roles.

cd ~/ltrdcn-3225/ansible/playbooks/aci/roles
ansible-galaxy init apic

You can view all the changes via the Visual Studio Code Browser or you can run the tree command. We'll mainly be working within the defaults, tasks, and vars directories. The defaults and vars directories contain variables to be used by the tasks, and as you probably guessed, the tasks will be placed within the tasks directory.

└── playbooks/
    └── aci/
        ├── group_vars/
        └── roles/
            └── apic/
                ├── defaults/
                │   └── main.yml
                ├── files/
                ├── handlers/
                │   └── main.yml
                ├── meta/
                │   └── main.yml
                ├── tasks/
                │   └── main.yml
                ├── templates/
                ├── tests/
                │   ├── inventory
                │   └── test.yml
                └── vars/
                    └── main.yml

13 directories, 8 files