Skip to content

Graphiant-Inc/graphiant-playbooks

Graphiant Playbooks

Python 3.7+ Ansible Terraform License: GPL v3+ 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 (v25.12.3) πŸ“– Documentation
Terraform Modules Infrastructure as Code for cloud connectivity πŸ“– Documentation
CI/CD Pipelines Automated testing, linting, building, and releasing πŸ“– GitHub
Docker Support Containerized execution environment πŸ“– Documentation

Quick Start

Prerequisites

  • Python 3.7+ (compatible with ansible-core 2.17, 2.18, 2.19, and 2.20)
  • 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.7 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r ansible_collections/graphiant/naas/requirements-ee.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.

Key Features

  • Idempotent Operations: All modules correctly report changed: false when no modifications occur
  • Structured Results: Manager methods return detailed results with changed, created, skipped, and deleted fields
  • Graceful Error Handling: Handles "object not found" errors gracefully in deconfigure operations
  • Jinja2 Template Support: Configuration files support Jinja2 templating for dynamic generation
  • Comprehensive Logging: Optional detailed logging for debugging and troubleshooting
  • Automated Releases: GitHub Actions workflow for building, publishing, and creating releases

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 (v25.12.3)
β”‚   β”œβ”€β”€ plugins/modules/                              # Ansible modules (6 modules)
β”‚   β”œβ”€β”€ plugins/module_utils/                         # Python library code
β”‚   β”œβ”€β”€ playbooks/                                    # Example playbooks
β”‚   β”œβ”€β”€ configs/                                      # Configuration templates
β”‚   β”œβ”€β”€ templates/                                    # Jinja2 templates
β”‚   β”œβ”€β”€ docs/                                         # Documentation
β”‚   β”œβ”€β”€ CHANGELOG.md                                  # Version history
β”‚   β”œβ”€β”€ README.md                                     # Collection documentation
β”‚   └── _version.py                                   # Centralized version management
β”œβ”€β”€ terraform/                                        # Terraform modules
β”‚   β”œβ”€β”€ gateway_services/                             # Cloud gateway services (AWS/Azure/GCP)
β”‚   └── edge_services/                                # Edge services
β”œβ”€β”€ scripts/                                          # Utility scripts
β”‚   β”œβ”€β”€ build_collection.py                          # Collection build script
β”‚   β”œβ”€β”€ bump_version.py                              # Version bumping script
β”‚   β”œβ”€β”€ 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 (multi-version testing)
β”‚   β”œβ”€β”€ build.yml                                    # Build workflow
β”‚   β”œβ”€β”€ release.yml                                  # Release workflow (auto-tag/release)
β”‚   └── README.md                                    # GitHub documentation
β”œβ”€β”€ SECURITY.md                                       # Security policy
β”œβ”€β”€ CONTRIBUTING.md                                   # Contribution guidelines
β”œβ”€β”€ CODE_OF_CONDUCT.md                               # Code of conduct
└── README.md                                         # This file

🀝 Contributing

We welcome contributions! See CONTRIBUTING.md for:

  • Development setup
  • Code standards
  • Testing requirements
  • Pull request process
  • Branch protection requirements
  • GPG signing requirements

See CODE_OF_CONDUCT.md for our community guidelines.

πŸ“„ License

This project is licensed under the GNU General Public License v3.0 or later (GPLv3+) - see the LICENSE file for details.

πŸ†˜ Support

πŸ”— Related Projects


Made with ❀️ by the Graphiant Team