Skip to content

Graphiant-Inc/graphiant-playbooks

Graphiant Playbooks

Python 3.10+ Ansible Terraform License: MIT Documentation

Automated network infrastructure management for Graphiant Network-as-a-Service (NaaS) offerings.

Refer Graphiant Docs to get started with Graphiant Network-as-a-Service (NaaS) offerings.

πŸ“š Documentation

Components

Component Description Documentation
Ansible Collection Ansible modules for Graphiant NaaS automation πŸ“– Documentation
Terraform Modules Infrastructure as Code for cloud connectivity πŸ“– Documentation
CI/CD Pipelines Automated testing, linting, and Docker builds πŸ“– GitHub
Docker Support Containerized execution environment πŸ“– Documentation

Quick Start

Prerequisites

  • Python 3.10+
  • Ansible Core 2.17+
  • Terraform v1.14+

Ansible Collection (Recommended)

# Clone the repository
git clone https://github.com/Graphiant-Inc/graphiant-playbooks.git
cd graphiant-playbooks

# Create virtual environment
python3.10 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r ansible_collections/graphiant/naas/requirements.txt

# Install collection from source
ansible-galaxy collection install ansible_collections/graphiant/naas/ --force

# Or install from Ansible Galaxy
ansible-galaxy collection install graphiant.naas

Example Playbook:

---
- name: Configure Graphiant network
  hosts: localhost
  gather_facts: false
  vars:
    graphiant_client_params: &graphiant_client_params
      host: "{{ graphiant_host }}"
      username: "{{ graphiant_username }}"
      password: "{{ graphiant_password }}"

  tasks:
    - name: Configure LAN interfaces
      graphiant.naas.graphiant_interfaces:
        <<: *graphiant_client_params
        interface_config_file: "interface_config.yaml"
        operation: "configure_lan_interfaces"

See the Ansible Collection README for complete documentation and Examples Guide for detailed usage examples.

Python Library

The collection can also be used as a Python library:

# Set PYTHONPATH for direct Python usage
export PYTHONPATH=$(pwd)/ansible_collections/graphiant/naas/plugins/module_utils:$PYTHONPATH
from libs.graphiant_config import GraphiantConfig

config = GraphiantConfig(
    base_url="https://api.graphiant.com",
    username="user",
    password="pass"
)
config.interfaces.configure_lan_interfaces("interface_config.yaml")

See ansible_collections/graphiant/naas/tests/test.py for comprehensive Python library usage examples.

Terraform Modules

Deploy cloud connectivity infrastructure with Terraform:

# Azure ExpressRoute
cd terraform/gateway_services/azure
terraform init
terraform plan -var-file="../../configs/gateway_services/azure_config.tfvars"
terraform apply -var-file="../../configs/gateway_services/azure_config.tfvars"

# AWS Direct Connect
cd terraform/gateway_services/aws
terraform init
terraform plan -var-file="../../configs/gateway_services/aws_config.tfvars"
terraform apply -var-file="../../configs/gateway_services/aws_config.tfvars"

# GCP InterConnect
cd terraform/gateway_services/gcp
terraform init
terraform plan -var-file="../../configs/gateway_services/gcp_config.tfvars"
terraform apply -var-file="../../configs/gateway_services/gcp_config.tfvars"

See the Terraform README for detailed setup instructions.

Project Structure

graphiant-playbooks/
β”œβ”€β”€ ansible_collections/graphiant/naas/  # Ansible collection
β”œβ”€β”€ terraform/                                          # Terraform modules
β”œβ”€β”€ scripts/                                            # Utility scripts (version management, validation, building)
β”‚   β”œβ”€β”€ build_collection.py                           # Collection build script
β”‚   β”œβ”€β”€ bump_version.py                               # Version bumping script
β”‚   β”œβ”€β”€ generate_requirements.py                      # Requirements generator
β”‚   β”œβ”€β”€ validate_collection.py                        # Collection validation script
β”‚   └── build_docsite.sh                              # Documentation build script
β”œβ”€β”€ .github/workflows/                                 # GitHub Actions workflows
β”‚   β”œβ”€β”€ lint.yml                                       # Linting workflow
β”‚   β”œβ”€β”€ test.yml                                       # Test workflow
β”‚   β”œβ”€β”€ build.yml                                      # Build workflow
β”‚   β”œβ”€β”€ release.yml                                    # Release workflow
β”‚   └── README.md                                      # GitHub documentation
└── README.md                                           # This file

🀝 Contributing

We welcome contributions! See CONTRIBUTING.md for:

  • Development setup
  • Code standards
  • Testing requirements
  • Pull request process

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

πŸ”— Related Projects


Made with ❀️ by the Graphiant Team