Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add tests and initial cli work #2

Merged
merged 3 commits into from
Dec 28, 2024
Merged

Conversation

rebelopsio
Copy link
Contributor

Add Configuration Management Tool (tbd-cfg)

Overview

This PR introduces a new configuration management tool (tbd-cfg) that integrates with our existing infrastructure as code system. The tool provides Ansible integration and shares state management with tbd-iac, enabling unified infrastructure and configuration management.

Key Features

  • Ansible playbook execution and validation
  • Shared state management with tbd-iac
  • TOML-based configuration files
  • Command-line interface with apply, validate, and import commands
  • Variable injection and environment targeting
  • Shell script provider support (scaffolded)

Implementation Details

Core Components

  • State Management: Created StateAdapter to interface with tbd-iac's state system
  • Ansible Integration: Implemented AnsibleWrapper for playbook execution and validation
  • Configuration: Added TOML-based config system with provider-specific implementations
  • CLI: Built command structure using clap with support for multiple operations

Example Configuration

name = "web-server"
target = "dev"
provider = { type = "ansible", playbook = "web.yml", inventory = "dev.yml" }
variables = { port = 80, domain = "example.com" }

Testing

  • Unit tests for core components
  • Integration tests with Ansible
  • CLI parsing tests
  • State management tests

Usage

# Apply configuration
tbd-cfg apply -c web-server.toml -t dev --vars '{"domain": "prod.example.com"}'

# Validate configuration
tbd-cfg validate -c web-server.toml

# Import existing Ansible playbook
tbd-cfg import -p playbook.yml -i inventory.yml -n web-setup

Development Details

  • Uses Task for automation and development workflows
  • GitHub Actions for CI/CD
  • Semantic versioning and release management
  • Integration with existing tbd-iac state system

Future Work

  • Add more comprehensive provider validations
  • Implement shell script provider
  • Add state migration capabilities
  • Enhance documentation

Testing Instructions

  1. Install Task: cargo install task
  2. Run tests: task test
  3. Try example configuration:
    task example
    task apply-example

Checklist

  • Core functionality implemented
  • Tests added
  • CI/CD configured
  • Documentation added
  • Example configurations provided

@rebelopsio rebelopsio merged commit 8cf0e11 into main Dec 28, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant