bradfordwagner.github-runner

Template Ansible Role

This document describes a basic structure and setup for creating an Ansible role. Ansible roles are a way to organize your automation code and make it reusable. Below are the simple key components for a template Ansible role.

Directory Structure

your_role/
├── defaults/
│   └── main.yml
├── files/
├── handlers/
│   └── main.yml
├── meta/
│   └── main.yml
├── tasks/
│   └── main.yml
├── templates/
├── tests/
│   └── test.yml
└── vars/
    └── main.yml

Description of Each Directory

  • defaults/: Contains default variables for the role, set in main.yml.
  • files/: Use this directory to store files that can be copied to the remote server.
  • handlers/: Special tasks that need to be run when notified, like restarting a service, stored in main.yml.
  • meta/: Contains metadata about the role like dependencies, set in main.yml.
  • tasks/: This is where you define the main tasks to execute, in main.yml.
  • templates/: Holds Jinja2 templates that can be dynamically created before being sent to the target hosts.
  • tests/: Contains tests for verifying the role works as expected, such as test.yml.
  • vars/: Contains variables specific to the role.

Steps to Create a Simple Role

  1. Create the directory structure as shown above.
  2. Fill in the defaults/main.yml file with default variable values.
  3. Add any files you want to copy to the remote server in the files/ directory.
  4. Define any handlers you need in handlers/main.yml.
  5. Write your tasks in tasks/main.yml.
  6. Use Jinja2 templates in the templates/ directory if needed.
  7. (Optional) Define any role-specific variables in vars/main.yml.
  8. Write tests in the tests/ directory.

This template helps structure your automation tasks clearly and effectively.

Informazioni sul progetto

installs gitub runners

Installa
ansible-galaxy install bradfordwagner.github-runner
Licenza
Unknown
Download
249
Proprietario