Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-aws.txt
pip install pytest

- name: Install vcsim
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
FROM python:3.14-slim AS builder

COPY requirements.txt .
COPY requirements-aws.txt .

ARG VENV=/opt/netbox-sync/venv
ARG INSTALL_AWS=false

# Install dependencies
RUN python3 -m venv $VENV && \
$VENV/bin/python3 -m pip install --upgrade pip && \
$VENV/bin/pip install -r requirements.txt && \
if [ "$INSTALL_AWS" = "true" ]; then $VENV/bin/pip install -r requirements-aws.txt; fi && \
$VENV/bin/pip install vmware-vcenter==9.1.1.0 && \
$VENV/bin/python3 -m pip uninstall -y pip && \
find $VENV -type d -name "__pycache__" -print0 | xargs -0 -n1 rm -rf
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ This is a tool to sync data from different sources to a NetBox instance.

Available source types:
* VMware vCenter Server
* AWS EC2, EBS, and network interfaces, with opt-in S3, Lambda, and EKS inventory (see [AWS source](docs/source_aws.md))
* [bb-ricardo/check_redfish](https://github.com/bb-Ricardo/check_redfish) inventory files

**IMPORTANT: READ INSTRUCTIONS CAREFULLY BEFORE RUNNING THIS PROGRAM**
Expand Down Expand Up @@ -38,6 +39,10 @@ This ensures stale objects are removed from NetBox keeping an accurate current s
* VMWare vCenter >= 6.0
#### Source: check_redfish (if used)
* check_redfish >= 1.2.0
#### Source: AWS (if used)
* Optional boto3 SDK, AWS read-only credentials, and automatic or explicit region discovery
* Optional AWS Organizations discovery with collector permissions and a trusted inventory role in each member account
* Existing VPC-specific NetBox VRFs for IP import; see [AWS setup](docs/source_aws.md)

# Installing
* here we assume we install in ```/opt```
Expand Down
763 changes: 763 additions & 0 deletions docs/source_aws.md

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion module/config/file_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from module.sources.vmware.config import VMWareConfig
from module.sources.check_redfish.config import CheckRedfishConfig
from module.sources.hetzner.config import HetznerConfig
from module.sources.aws.config import AWSConfig
from module.common.logging import get_logger
from module.config import default_config_file_path, source_config_section_name
from module.config.files import ConfigFile, ConfigFileINI, ConfigFileYAML
Expand All @@ -35,7 +36,8 @@ class ConfigFileOutput(DescriptionFormatterMixin):
source_config_list = [
VMWareConfig,
CheckRedfishConfig,
HetznerConfig
HetznerConfig,
AWSConfig
]

header = f"Welcome to the {__description__} configuration file."
Expand Down
10 changes: 7 additions & 3 deletions module/netbox/object_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,8 @@ def __init__(self, *args, **kwargs):
NBInventoryItem.object_type,
NBPowerPort.object_type,
NBClusterGroup.object_type,
NBCluster.object_type,
NBVirtualDisk.object_type,
NBVMInterface.object_type,
NBVM.object_type,
NBModule.object_type
Expand Down Expand Up @@ -1560,7 +1562,6 @@ class NBVRF(NetBoxObject):
object_type = "ipam.vrf"
primary_key = "name"
prune = False
read_only = True

def __init__(self, *args, **kwargs):
self.data_model = {
Expand Down Expand Up @@ -1953,7 +1954,8 @@ def __init__(self, *args, **kwargs):
"scope_id": self.scopes,
# supports pre4.2.0 clusters with site
"site": NBSite,
"tags": NBTagList
"tags": NBTagList,
"custom_fields": NBCustomField
}
super().__init__(*args, **kwargs)

Expand Down Expand Up @@ -2071,6 +2073,7 @@ def __init__(self, *args, **kwargs):
"untagged_vlan": NBVLAN,
"tagged_vlans": NBVLANList,
"description": 200,
"custom_fields": NBCustomField,
"tags": NBTagList
}
super().__init__(*args, **kwargs)
Expand Down Expand Up @@ -2173,7 +2176,8 @@ def __init__(self, *args, **kwargs):
"virtual_machine": NBVM,
"description": 200,
"size": int, # in MB
"tags": NBTagList
"tags": NBTagList,
"custom_fields": NBCustomField
}
super().__init__(*args, **kwargs)

Expand Down
3 changes: 2 additions & 1 deletion module/sources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# define all available sources here
from module.sources.vmware.connection import VMWareHandler
from module.sources.hetzner.connection import HetznerHandler
from module.sources.aws.connection import AWSHandler
from module.sources.check_redfish.import_inventory import CheckRedfish

from module.common.logging import get_logger
Expand All @@ -19,7 +20,7 @@
from module.config import source_config_section_name

# list of valid sources
valid_sources = [VMWareHandler, CheckRedfish, HetznerHandler]
valid_sources = [VMWareHandler, CheckRedfish, HetznerHandler, AWSHandler]


def validate_source(source_class_object=None, state="pre"):
Expand Down
10 changes: 10 additions & 0 deletions module/sources/aws/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020 - 2026 netbox-sync team. All rights reserved.
#
# netbox-sync.py
#
# This work is licensed under the terms of the MIT license.
# For a copy, see file LICENSE.txt included in this
# repository or visit: <https://opensource.org/licenses/MIT>.

from module.sources.aws.connection import AWSHandler
Loading
Loading