07 Objective: Reusability and Doctrine – Roles

Write once.
Execute unlimited.
The Ghost Ops way.

Variables – loaded.
Templates – locked.
Tasks – trained.
Playbooks – executing.

Roles – fixed directory structures of Ansible code.

Structure Is Clarity – The Role Directories

role-dir/
        |- example-role/
                |
                |- tasks      # Task files, main.yml is required and read first
                |- handlers   # Triggered tasks
                |- defaults   # Default variables
                |- files      # Static files
                |- templates  # Dynamic template files, Jinja2

Roles can contain vars and meta directories, but Ghosts keep the blades light – not every payload is necessary.

Look for a template? /templates.
Look for a task? /tasks.

Clean.
Predictable.
Reusable.

Ansible Galaxy – The Fire That Can Burn You

You have your roles.
You want to reuse them.
To distribute – use Ansible Galaxy.

ansible-galaxy is a powerful blade.
It can download, install, and share roles – by default from the public cloud.

Ghosts don’t trust the cloud.
But ansible-galaxy supports local paths, Git, and secured sources.

Stay private. Stay safe. Stay Ghost.

Final Whisper

Roles are powerful. Clear. Reusable.

One role – one mission.
One mission – one purpose.

Ansible supports logic.
Don’t let logic become noise.

Inflated roles kill clarity.
Stay sharp. Stay Ghost.


Discover more from Tom's IT Cafe

Subscribe to get the latest posts sent to your email.

Leave a comment