A lightweight YAML-based task runner designed to simplify operational scripts and replace complex Bash automation with structured, readable configuration.
This tool allows you to define automation workflows in YAML and execute them as CLI commands. It is especially useful for DevOps workflows, deployment pipelines, infrastructure tasks, and local automation.
Instead of maintaining large deploy.sh or setup.sh scripts, you can define the same logic in YAML with support for template variables, services configuration, and reusable steps.
Bash scripts often grow into large, hard-to-maintain files.
Example problem:
deploy.sh
git clone https://repo
cd service
npm install
npm run build
sudo systemctl restart api
ansible-playbook deploy.ymlProblems:
- Hard to maintain
- Hard to parameterize
- Hard to reuse
- Difficult to document
YAML Processor solves this by introducing structured automation.
Example YAML:
name: deploy-blog
version: 1
gitUrl: https://github.com/AyushAher/blog
services:
- name: api
port:
- 3000
steps:
- echo Cloning repository
- git clone {{gitUrl}}
- echo Restarting {{services.$0.name}}- YAML-based task automation
- Template variable support
- Service definitions
- Sequential step execution
- CLI-based execution
- Safe YAML parsing
- Modular architecture
- Works with existing tools (Ansible, Docker, Git, etc.)
YAML Processor is designed to help with:
build
test
deploy
cleanup
Instead of large deployment scripts:
deploy.sh
Use:
deploy.yaml
Examples:
- Docker deployments
- Ansible orchestration
- Terraform operations
- Server maintenance
Example:
steps:
- docker compose pull
- docker compose up -dUseful for managing local infrastructure.
Example:
steps:
- git pull
- docker build -t api .
- docker compose restartClone the repository:
git clone https://github.com/AyushAher/Yaml_Processor.git
cd Yaml_Processor
Install dependencies:
pip install -r requirements.txt
Run a YAML workflow:
python cli.py sample.yaml
The processor will:
- Load the YAML configuration
- Resolve template variables
- Parse execution steps
- Execute commands sequentially
A YAML file can contain the following sections.
name: sampleYaml
version: 1
gitUrl: https://github.com/example/repo
services:
- name: api
port:
- 3000
steps:
- echo Starting deployment
- git clone {{gitUrl}}You can reference values defined in the YAML file.
Example:
steps:
- echo Deploying {{services.$0.name}}Access rules:
{{object.field}}
{{list.$index.field}}
Example:
{{services.$1.name}}
name: deploy-service
version: 1
gitUrl: https://github.com/company/service
services:
- name: Node-Api
port:
- 3000
- 3001
- name: dotnet-api
port:
- 71009
steps:
- echo Cloning repository
- git clone {{gitUrl}}
- echo Starting {{services.$0.name}}Execution flow:
YAML File
↓
Load YAML
↓
Resolve Template Variables
↓
Parse Steps
↓
Execute Commands
Commands are executed using Python's subprocess module.
- YAML files are parsed using
yaml.safe_load - Shell commands are executed without
shell=True - Template variables are validated during parsing
Only run YAML configurations from trusted sources.
Yaml_Processor/
│
├── cli.py
├── sample.yaml
├── requirements.txt
│
├── Services/
│ ├── ProcessYaml.py
│ ├── Yaml_Runner.py
│ └── SaveFile.py
Planned enhancements include:
.envsupport for environment variables- Task-based execution
- Parallel task execution
- Dependency graph for tasks
- Logging system
- Dry-run mode
- Workspace isolation
Contributions are welcome.
If you'd like to improve the project:
- Fork the repository
- Create a feature branch
- Submit a pull request
This project is licensed under the MIT License.