Skip to content

Ansible Testing


This Ansible roles purpose is to enable unit and functional testing of Ansible Playbooks. Tests are declared using a simple yaml file.

Features

This role deploys a K3s cluster. In addition it has the following features:

  • Unit Testing

    Designed to test the individual components of a playbook.

    • syntax check of all playbooks

    • more planned

  • Functional testing

    designed to test the functionality of a playbook.

    • planned feature
  • Mock Roles

  • Test Artifacts

  • XUnit xml test report

Role Workflow

The role workflow is broken down into stages with job_tags being the method of choosing the stage. The workflows are as follows:

  1. Test Setup

    1. finds all playbooks

    2. finds all roles used in playbooks

    3. creates mock roles

    4. creates a test fixture

  2. Unit Testing

    1. loads test fixture

    2. iterates over all playbooks

      1. conducts Syntax Check
    3. stores results in test artifact

  3. Functional testing (planned)

  4. Report Creation

    1. counts passed tests

    2. counts failed tests

    3. creates XUnit xml test report

Default Variables

defaults/main.yaml
---
playbook_excludes:
  - gitlab-ci
  - docs
  - cz.yaml
  - .md
  - .git
  - .nfc_automation
  - scratchpad
  - test
  - LICENSE
  - .cfg
  - website-template
  - tasks/

About:

This page forms part of our Project Testing Ansible Role.

Page Metadata
Version: ToDo: place files short git commit here
Date Created: 2023-12-17
Date Edited: 2023-12-20

Contribution:

Would You like to contribute to our Testing Ansible Role project? You can assist in the following ways:

 

ToDo: Add the page list of contributors