This repository contains automation to provision a modular Active Directory lab with a variety of optional components for a child domain, separate administrative forest, certificate authority, Linux and Windows member servers, and SQL Server. The optional components can be enabled as needed to test various scenarios.
---
config:
flowchart:
nodeSpacing: 20
inheritDir: true
defaultRenderer: "elk"
themeVariables:
fontFamily: 'monospace'
fontSize: '12px'
lineColor: '#7a7a7a'
edgeLabelBackground: 'transparent'
textColor: '#000000'
---
flowchart BT
subgraph lab["lab"]
%% lab.test domain
subgraph lab_test ["lab.test"]
%% Nodes
ad_root_dir1@{ shape: rect, label: "dir1"}
ad_root_dir2@{ shape: rect, label: "dir2"}
ad_root_cs1@{ shape: rect, label: "cs1"}
ad_root_lnx_srv@{ shape: st-rect, label: "lnx#"}
ad_root_win_srv@{ shape: st-rect, label: "srv#"}
ad_root_win_sql1@{ shape: cyl, label: "sql1"}
%% Node styles
ad_root_dir1:::dc
ad_root_dir2:::dc
ad_root_cs1:::cs
ad_root_win_srv:::windows
ad_root_lnx_srv:::linux
ad_root_win_sql1:::sql
%% Node links
ad_root_cs1 --dns server--> ad_root_dir1
ad_root_cs1 --dns server--> ad_root_dir2
ad_root_dir1 --cert enroll--> ad_root_cs1
ad_root_dir1 --dns server--> ad_root_dir2
ad_root_dir2 --cert enroll--> ad_root_cs1
ad_root_dir2 --dns server--> ad_root_dir1
ad_root_lnx_srv --dns server--> ad_root_dir1
ad_root_lnx_srv --dns server--> ad_root_dir2
ad_root_win_sql1 --dns server--> ad_root_dir1
ad_root_win_sql1 --dns server--> ad_root_dir2
ad_root_win_srv --dns server--> ad_root_dir1
ad_root_win_srv --dns server--> ad_root_dir2
end
%% child.lab.test domain
subgraph child_lab_test ["child.lab.test"]
%% Nodes
ad_child_dir3@{ shape: rect, label: "dir3"}
ad_child_dir4@{ shape: rect, label: "dir4"}
%% Node styles
ad_child_dir3:::dc
ad_child_dir4:::dc
%% Node links
ad_child_dir3 --cert enroll--> ad_root_cs1
ad_child_dir3 --dns server--> ad_root_dir1
ad_child_dir3 --dns server--> ad_root_dir2
ad_child_dir4 --cert enroll--> ad_root_cs1
ad_child_dir4 --dns server--> ad_root_dir1
ad_child_dir4 --dns server--> ad_root_dir2
end
%% admin.local domain
subgraph admin_local ["admin.local"]
%% Nodes
ad_admin_dir5@{ shape: rect, label: "dir5"}
%% Node styles
ad_admin_dir5:::dc
end
end
%% Sub-chart styles
admin_local:::domain
child_lab_test:::domain
lab_test:::domain
lab:::lab
%% Node links
lab_test --trust (one-way)--> admin_local
lab_test --trust (two-way)--> child_lab_test
%% Style classes
classDef cs fill:#16a34a,stroke:#333333,stroke-width:1px,color:#fff
classDef dc fill:#054165,stroke:#333333,stroke-width:1px,color:#fff
classDef domain fill:#cedae2,stroke:#333333,stroke-width:1px,color:#333
classDef lab fill:#e8edf3,stroke:#333333,stroke-width:1px,color:#333
classDef linux fill:#f7bb36,stroke:#333333,stroke-width:1px,color:#422006
classDef sql fill:#7c3aed,stroke:#333333,stroke-width:1px,color:#fff
classDef windows fill:#2563eb,stroke:#333333,stroke-width:1px,color:#fff
| folder | purpose |
|---|---|
| packer | Packer template for Ubuntu Server 24.04 and Windows Server 2025 Vagrant boxes |
| vagrant | Vagrantfile and Ansible playbooks for Active Directory lab |
- VMs
- VM name:
ad-root-dir1- Hostname:
dir1 - Virtual hardware
- 2 vCPU
- 4 GB RAM
- Synced folder(s)
vagrant/files/mounted toc:\vagrant
- Provisioners
vagrant/files/common/windows/os/main.yml: Base OS configurationvagrant/files/ad-root/main.yml: Create root domain, configure DNS server and logging, create sample users
- Hostname:
- VM name:
- Physical host
- Hardware
- 4+ vCPU
- 32+ GB RAM
- 15+ GB available storage
- The VirtualBox VMs are provisioned as linked clones to conserve disk space.
- Operating system
- Ubuntu Linux 22.04+
- Software
- Ansible 2.16+
- VirtualBox 7+
- Packer 1.14+
- Vagrant 2.x
vagrant-disksizepluginvagrant-reloadpluginvagrant-vbguestplugin
- Hardware
The packer directory contains a Packer template to build VirtualBox Vagrant boxes for Ubuntu Server 24.04 LTS and Windows Server 2025.
The Vagrant box build takes approximately 15 minutes, but may vary depending on your hardware and internet connection.
The box file is output to packer/ubuntu-server-24.04/ubuntu-server-24.04.box and is approximately 2.5 GBs.
-
Build the Vagrant box:
# Set working directory cd packer/ubuntu-server-24.04/ # Build the box packer build .
The Vagrant box build takes approximately 15 minutes, but may vary depending on your hardware and internet connection.
The box file is output to packer/ubuntu-server-24.04/ubuntu-server-24.04.box and is approximately 2.5 GBs.
The Vagrant box build takes approximately 45 minutes, but may vary depending on your hardware and internet connection.
The box file is output to packer/windows-server-2025/windows-server-2025.box and is approximately 14 GBs.
-
Place the ISO at
packer/windows-server-2025/windows-server-2025.iso. -
Build the Vagrant box:
# Set working directory cd packer/windows-server-2025/ # Build the box packer build .
The vagrant directory contains the Vagrantfile to build the Active Directory lab environment. To build the environment:
-
Review the settings variables in
vagrant/settings.ymland update as necessary. This file contains the variable switches to enable the optional components of the lab environment. The following settings variables are available:Variable name Default value Purpose ad_admin_domain_deployfalseSwitch to enable Administrative domain deployment ad_admin_domain_nameadmin.localAdministrative domain name ad_admin_dir5_ip10.0.3.10Administrative domain Domain Controller IP ad_child_domain_deployfalseSwitch to enable child domain deployment ad_child_domain_namechild.lab.testChild domain name ad_child_dir3_ip10.0.3.101Child domain Domain Controller IP ad_child_dir4_ip10.0.3.102Child domain Domain Controller IP ad_cs_deployfalseSwitch to enable Active Directory Certificate Services deployment ad_cs1_ip10.0.3.25Active Directory Certificate Services IP address ad_root_domain_namelab.testRoot domain name ad_root_dir1_ip10.0.3.21Root domain Domain Controller IP ad_root_dir2_ip10.0.3.22Root domain Domain Controller IP ad_server_windows_sql_deployfalseSwitch to deploy SQL server ad_server_windows_sql_ip10.0.3.60SQL server IP address ad_servers_linux_deployfalseSwitch to deploy Linux server(s) ad_servers_linux_count1Number of Linux servers to deploy ad_servers_linux_start_ip10.0.3.40Starting IP address for Linux servers ad_servers_windows_deployfalseSwitch to deploy Windows server(s) ad_servers_windows_count1Number of Windows servers to deploy ad_servers_windows_start_ip10.0.3.30Starting IP address for Windows servers gateway_ip10.0.3.1Network gateway address host_adapter_bridgeenp12s0Host network adapter for bridge network -
Provision the environment:
# Set working directory cd vagrant # Provision vagrant up
-
Play
-
When finished, destroy the environment:
# Set working directory cd vagrant # Destroy vagrant destroy --force