AI-powered infrastructure management
Project description
Opsbox
AI-Powered Infrastructure Management
Welcome to Opsbox, the open-source platform that adds a dash of AI magic to your infrastructure management. With our flexible plugin system and policy-as-code approach using Rego, managing your infrastructure has never been this enjoyable!
Features
- 🎛️ Plugin System: Customize and extend functionality with ease.
- 📝 Policy-as-Code with Rego: Define compliance checks and policies efficiently.
- 🤖 AI Assistance: Leverage AI models to analyze and process your infrastructure data.
- 💻 Command-Line Interface: An interactive CLI.
- 📚 Documentation Support: Generate and view documentation effortlessly using mkdocs.
Installation
Ready to dive in? Let's get you set up!
Prerequisites
- Python 3.11
- uv
Through PyPI
Simply run pip install opsbox to install the minimal set of opsbox tools.
If using UV, initilize your project using uv init.
then uv add opsbox
Note: If you want to install AWS plugins, use the aws extras group, opsbox[aws]
Through Github
-
Clone the Repository
git clone https://github.com/sudoersllc/Opsbox.git cd Opsbox
-
Install with uv
We use [
uv] for managing dependencies. If you don't have it installed, you can get it via pip:pip install uv
Now, let's install Opsbox:
uv syncThis command will install all required dependencies specified in
pyproject.toml.
Using Rego Plugins
Open Policy Agent (OPA) is an open-source policy engine that enables organizations to implement policy as code across diverse environments. Its policy language, Rego, allows users to define rules that dictate system and application behavior.
We use rego code to gather details about connected systems, alongside an Open Policy Agent (OPA) server, then format it for consumption by a language model.
Create a OPA Policy docker image
To run OpsBox with rego plugins, you'll need an OPA server. This is because OpsBox uses OPA to enforce policies on all resources that are being managed.
if you don't have OPA installed on your machine, or you dont have a running OPA instance, you can create a docker image for OPA.
Start by installing docker.
Create a dockerfile and add the following code:
# Use the official OPA image
FROM openpolicyagent/opa:latest
# Expose OPA's default port
EXPOSE 8181
# Run OPA with the specified policy file
CMD ["run", "--server", "--addr", "0.0.0.0:8181"]
Navigate to the directory and Build the Docker image:
docker build -t opa-server .
or you can also follow the offical OPA documentation to create the engine: OPA Documentation
Finally, run the OPA server as follows:
docker run -d -p 8181:8181 --name opa-server opa-server
The docker image can be found here: (https://hub.docker.com/r/openpolicyagent/opa/)
docker run -d -p 8181:8181 --name opa openpolicyagent/opa run --server --addr=0.0.0.0:8181*
Running Opsbox
Time to see the magic in action!
Simply run:
uv run opsbox ...
or, if not using UV:
python -m opsbox ...
This will launch Opsbox and display the CLI help along with available commands.
Example Usage
Want to run a specific pipeline? Here's how:
uv run opsbox --modules your_input-your_optional_assistant-your_output --opa_url http://your-opa-url
A recommended command to start is stray_ebs make sure you have opsbox[aws] and opsbox-cli-output installed
uv run opsbox --modules stray_ebs-cli_out --opa_url http://localhost:8181/ --aws_access_key_id {YOUR_ACCESS_KEY_ID} --aws_secret_access_key {YOUR_SECRET_ACCESS_KEY} --aws_region us-east-1
or, if not using UV:
python -m opsbox --modules your_input-your_optional_assistant-your_output --opa_url http://your-opa-url
python -m opsbox --modules stray_ebs-cli_out --opa_url http://localhost:8181/ --aws_access_key_id {YOUR_ACCESS_KEY_ID} --aws_secret_access_key {YOUR_SECRET_ACCESS_KEY} --aws_region us-east-1
Configuration
Opsbox is flexible when it comes to configuration. You can provide options via:
- Command-Line Arguments
- Configuration Files
- Environment Variables
Using a Configuration File
Create a file named .opsbox_conf.json in your home directory:
{
"aws_access_key_id": "YOUR_ACCESS_KEY_ID",
"aws_secret_access_key": "YOUR_SECRET_ACCESS_KEY",
"aws_region": "YOUR_AWS_REGION",
"opa_url": "http://your-opa-url",
}
To run a command with a config it will follow this format
uv run opsbox --modules stray_ebs-cli_out --config config.json
Command-Line Arguments
You can also provide configuration options directly through the command line:
python -m opsbox --modules example_module --aws_access_key_id YOUR_ACCESS_KEY_ID --aws_secret_access_key YOUR_SECRET_ACCESS_KEY --aws_region YOUR_AWS_REGION --opa_url http://your-opa-url
Plugins
You'll probably want some plugins to get started!
Opsbox plugins published by gsudoers normally take the format of opsbox-<name>-<plugin_type>, and are accessible and searchable through PyPI.
There's also a collection of plugins available for AWS systems, installable by using the pip extras group aws:
pip install 'opsbox[aws]'
Let's Get Started!
Now that you're all set, it's time to unleash the power of AI on your infrastructure. Happy automating!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file opsbox-0.2.1.tar.gz.
File metadata
- Download URL: opsbox-0.2.1.tar.gz
- Upload date:
- Size: 32.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56236dbb43449762e57fde7b5bfc1076695eea4bcd8f53ff0d5ad5dd88a32395
|
|
| MD5 |
8664d79fd0abc4ac9cac2c68f93d3824
|
|
| BLAKE2b-256 |
0701505b7f3f6d11cb58861887e2c2dbb8b5f372e0eac5603a53c8ed85e56658
|
File details
Details for the file opsbox-0.2.1-py3-none-any.whl.
File metadata
- Download URL: opsbox-0.2.1-py3-none-any.whl
- Upload date:
- Size: 29.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e7859657299819bd91e07a0a20ff4784ea98a0fdbe30fad8dd4bb477b7fc0f4
|
|
| MD5 |
09c4ba67dadf56f6cb184ce2fd8c0bcb
|
|
| BLAKE2b-256 |
91aa490b7869d6e3e008f0c0c1d4c7726255475716c2dde11c7e7b757934953c
|