this repo exists for me to learn netbox related functionality by doing things hands-on and commiting them as reproducible examples. as a side-effect it also serves as a set of live demonstrable examples of netbox functionality.
this is fundamentally a terraform project, so the main workflow (once everything is setup) goes:
terraform apply- do your hacking/testing/demo
terraform destroy
NOTE: this is a TEMPORARY LAB environment.
it is all written/designed with the expectation that the environment be SHORT LIVED (hours, not days).
nothing in here is to be taken as best practice or production level config.
this project assumes a set of command line tools are installed. you can copy/paste this command to verify you have them, or see which ones you don't:
for cmd in terraform aws session-manager-plugin kubectl helm; do command -v "$cmd" > /dev/null || echo "missing: $cmd"; done
if you see nothing, you're good. for any that are missing, follow the instructions below for your OS.
install homebrew (if you don't already have it)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install terraform awscli session-manager-plugin kubernetes-cli helm
https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli
https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
https://docs.aws.amazon.com/systems-manager/latest/userguide/install-plugin-debian-and-ubuntu.html
sudo apt install -y kubectl
https://helm.sh/docs/intro/install/#from-apt-debianubuntu
-
setup your aws cli authentication. verify with:
aws sts get-caller-identity -
clone this repo
git clone https://github.com/jbartus/netbox-lab.git -
cdinto itcd netbox-lab -
initialize terraform (pull in providers & modules)
terraform init -
copy the example variables file to your own
cp terraform.tfvars.example terraform.tfvars -
edit your
terraform.tfvarsfile- enable the components you're looking to test or demo by setting them to
true - for netbox enteprise add your license id.
- enable the components you're looking to test or demo by setting them to
-
run a
planto check for errorsterraform plan
-
kick off the setup (the main event)
terraform apply -
test or demonstrate your thing
depending on what you set to
truein yourterraform.tfvarsyou will see a mix of URL and SSM outputsfor the SSM commands you can simply copy & paste them to get command line access to the VM in question, where you will almost always want to run
sudo -ifirst thingfor the URLs you can click or copy/paste them into a browser, however note that while the VMs usually only take a minute or two to launch, an actual netbox install takes about 5 minutes for community and 10 minutes for enterprise, so you will need to wait a bit for them to be ready
also note that I have used "dummy" TLS certificates, so your browser will warn you that they are not valid, you need to click whatever your browsers version of "i understand let me through anyway" is.
login with the default credentials (
admin/admin) or the ones you specified interraform.tfvars -
cleanup (very important step!)
terraform destroy
vpc.tfcreates the base vpc that all of this lives inssm.tfenables the use of ssm-session-manager, which means we don't expose ssh ports or bother with ssh keys, and we can use the aws console's ec2 instance "connect" option to display the terminal in a browser.docker.tfanddocker.shsetup the community netbox-dockerdocker composestackcommunity.tfandcommunity.shsetup netbox community (open source)enterprise.tf,enterprise.sh.tplandconfig.yaml.tplsetup netbox enterprise ("on-prem")mitmproxy*sets up an outbound TLS proxy and routes the NBE install through itc8kv.tfsets up a Cisco 8000V ec2 instance running ios xe. it doesn't do anything but exist to be a target of scanning/discovery/configuration-automation.orb.tf,orb.sh.tplandorb.yaml.tplsetup the netbox orb discovery agent (pointed at the enterprise VM & the above "router" VM), including a vault instance for a test/dummy "secret"msft-dns-dhcp.tfandmsft-dns-dhcp.ps1setup a standalone windows server 2022 running both DNS and DHCP. acts as a combined data source for the NetBox Microsoft DNS integration and the NetBox Microsoft DHCP integrationeks.tfsets up a small EKS cluster running on spot instancescommunity-helm.shsets up netbox community using an external RDS db frompostgres.tfenterprise-helm.shandenterprise-values.yamlsetup netbox enterprise on EKSansible.tfandansible.sh.tplsetup a vm for running ansible playbooks/runbooks.ansible-in.yamlpopulates a netbox instance with some dummy/demo dataad-ldap.tfandad-ldap.ps1setup a windows domain controller to act as an LDAP authentication source, which works with the example config inad-ldap-config.txtplaced in the Advanced Settings section of the Enterprise consolekeycloak.tfandkeyloak.shsetup a keycloak server for SAML authentication, with a base/starter (that requires filling out a few things) insaml-config.txt(note: you will also have to edit the redirect url in keycloak)rhel.tfandubuntu.tfare just plain/bare standalone VMs for when I need to test specific-distro things
tail -n 50 /var/log/cloud-init-output.logcat /var/lib/cloud/instance/scripts/part-001