## INTRODUCTION TO ROLES

Project with Embedded Roles Example:

Ansible Terminal

    Some directories omitted for readability
    ├── site.yml
    └── roles
        ├── apache_role
        │   ├── defaults
        │   │   └── main.yml
        │   ├── files
        │   │   └── index.html
        │   ├── handlers
        │   │   └── main.yml
        │   ├── tasks
        │   │   └── main.yml
        │   ├── templates
        │   │   └── http.conf.j2
        │   └── vars
        │       └── main.yml
        └── security_standards
            ├── defaults
            │   └── main.yml
            ├── files
            │   ├── sshd_conf
            │   └── sudoers
            ├── handlers
            │   └── main.yml
            ├── tasks
            │   └── main.yml
            ├── templates
            │   ├── etc_issue
            │   └── etc_motd
            └── vars
                └── main.yml

Some Interesting Files To Consider

    apache_role
        tasks/main.yml
        defaults/main.yml
        files/index.html
        templates/http.conf.j2
        vars/main.yml

    security_standards
        tasks/main.yml
        defaults/main.yml
        files/sshd_conf
        files/sudoers
        templates/etc_issue
        templates/etc_motd
        vars/main.yml

This slide shows an example file system with a top-level playbook (site.yml) and two sample roles (common and apache) embedded in the project. Notice how the file structure under each role are similar to what we find in a play. Role deconstruct the content we'd put in a play and package it up in such a way that it is portable and easily shared and reused.