No description
Find a file
2025-11-03 09:10:57 -05:00
.github/workflows vibe coded a crapton here 2025-10-08 13:53:38 -04:00
bootstrap/playbooks vibe coded a crapton here 2025-10-08 13:53:38 -04:00
modules Update a bit more to get the switch more fully working and work towards a high-level trunking setup 2025-11-03 09:10:57 -05:00
netbox vibe coded a crapton here 2025-10-08 13:53:38 -04:00
virtualization plan does nothing, setup router now 2025-10-21 12:48:20 -04:00
webhook vibe coded a crapton here 2025-10-08 13:53:38 -04:00
.gitignore Update a bit more to get the switch more fully working and work towards a high-level trunking setup 2025-11-03 09:10:57 -05:00
.goosehints Update instructions a bit more 2025-11-01 13:22:59 -04:00
.terraform.lock.hcl inits at least 2025-10-08 13:59:51 -04:00
network.tf Update a bit more to get the switch more fully working and work towards a high-level trunking setup 2025-11-03 09:10:57 -05:00
plan.json Update a bit more to get the switch more fully working and work towards a high-level trunking setup 2025-11-03 09:10:57 -05:00
providers.tf inits at least 2025-10-08 13:59:51 -04:00
README.md Correct model number here 2025-10-30 09:58:47 -04:00
terraform.tfstate Now reflects working trunk setup and vlan tagging 2025-11-01 13:36:17 -04:00
ultrafast_import.sh base config for the 100gbe switch, need to build out modules/switch/ to handle bonding too 2025-10-22 10:56:11 -04:00
ultrafast_import.tf.reference First pass at DRY for some bits 2025-10-23 18:39:21 -04:00
variables.tf Working on adding all needed features for ultrafast 2025-10-23 16:11:38 -04:00
vlans.tf Going to see what goose does 2025-10-29 15:14:37 -04:00

MikroTik CRS + Proxmox + NetBox — IaC Starter (Generated)

This repository contains a proof-of-concept Infrastructure-as-Code layout to manage:

What is included

  • network.tf — Main Terraform file to configure the MikroTik switches via the RouterOS Terraform provider.\n- modules/ — Directory containing reusable Terraform modules for switch, VLAN, and VM configurations
  • virtualization/ — Terraform code to create/manage VMs on Proxmox via the Telmate Proxmox provider.
  • netbox/ — YAML import file with the initial NetBox objects for this PoC.
  • bootstrap/ — Ansible playbook to bootstrap RouterOS for API/REST access and create an automation user.
  • webhook/ — Simple Flask webhook receiver to trigger CI runs.
  • .github/workflows/terraform.yml — GitHub Actions workflow for plan/apply (example).

Infrastructure Overview

This setup manages a complex network infrastructure with multiple VLANs and switch configurations:

MikroTik Switches Configuration

The infrastructure includes two MikroTik switches:

  1. gigabit-backbone (192.168.0.32)

    • CRS354-48P-4S+2Q+RM switch model
    • 48 Ethernet ports (ether1-ether48) with various configurations
    • 4 SFP+ ports for fiber connections
    • 2 QSFP+ ports for high-speed connections
    • VLAN tagging and trunking capabilities
  2. ultrafast (192.168.0.33)

    • CRS312+4C+8XG-RM switch model
    • 8 Ethernet ports with PoE support
    • Bonding interfaces for link aggregation
    • Jumbo frame support for high-performance networking

Network VLANs

The network is organized into multiple VLANs with different security levels:

  • Secure VLANs: LAN (VLAN 1), PRIVATE (VLAN 17)
  • Insecure VLANs: IoT (VLAN 8), MEDIA (VLAN 6), CAMSEC (VLAN 20), WORK (VLAN 72)
  • Special purpose VLANs: LTE (VLAN 3), HIGHAV (VLAN 4), JUMBO (VLAN 129)

Modules Directory Structure

The modules/ directory contains reusable Terraform modules:

switch Module

Configures MikroTik switches with complex bridge and VLAN functionality:

  • Bridge creation and configuration
  • Bridge port management with tagging and untagging
  • Ethernet interface configuration (PoE, MTU, flow control)
  • Bonding interface setup
  • VLAN filtering capabilities

vlan Module

Defines VLAN configurations for network segmentation:

  • VLAN ID assignment
  • VLAN name and description
  • Network subnet definitions
  • Reusable across multiple switch configurations

vm Module

Manages Proxmox virtual machines:

  • VM creation with specified resources (cores, memory)
  • Network interface configuration with VLAN tagging
  • Disk configuration
  • VM naming and node assignment

Key Features

  • Complex bridge configurations with VLAN filtering
  • Bonding interfaces for redundancy and increased bandwidth
  • Ethernet port configuration with MTU and PoE settings
  • Trunking of VLANs between switches using tagged port configurations
  • Integration with NetBox for network management

Important: This is a starting point. Do not store secrets in the repository. Use GitHub Secrets / Vault / SOPS / Ansible Vault to protect credentials. Test in a lab before applying to production.

Quickstart (local/lab)

  1. Update variables and provider credentials in the Terraform *.tfvars or environment variables. The files use variables and placeholders.
  2. Run the Ansible playbook in bootstrap/ to configure the switch so the RouterOS API/REST is available to Terraform.
  3. From the root directory run terraform init and terraform plan (or use CI).

See each directory for further notes and config examples.