Skip to content

refactor: restructure GOAD as an Ansible collection and flatten roles#53

Merged
l50 merged 12 commits into
mainfrom
worktree-ansible-collection-v2
Mar 31, 2026
Merged

refactor: restructure GOAD as an Ansible collection and flatten roles#53
l50 merged 12 commits into
mainfrom
worktree-ansible-collection-v2

Conversation

@l50
Copy link
Copy Markdown
Contributor

@l50 l50 commented Mar 31, 2026

Key Changes:

  • Converted repository to a standalone Ansible collection (dreadnode.goad)
  • Flattened all nested roles into a single roles/ directory with prefix naming
  • Moved playbooks to playbooks/ and updated all role references to FQCN
  • Removed legacy Python, Vagrant, and Terraform components

Added:

  • galaxy.yml and meta/runtime.yml defining the collection and requirements
  • changelogs/ directory with initial release summary and changelog config
  • roles/ directory for all roles, now flattened and prefixed for clarity
  • playbooks/ directory containing all orchestration playbooks
  • plugins/modules/ directory for custom PowerShell modules
  • Updated and extended collection-level README.md with architecture, usage, and requirements

Changed:

  • All playbooks now use fully qualified collection role names (dreadnode.goad.*)
  • Taskfile, scripts, and docs updated to reference new paths (e.g., playbooks/ and roles/)
  • .gitignore modernized to reflect collection structure and ignore legacy artifacts
  • Ansible configuration (ansible.cfg) moved to root and updated for new role/collection paths
  • Dependency management standardized in requirements.yml for Ansible Galaxy
  • All documentation and code examples updated to reflect the collection format

Removed:

  • All Python-based provisioner, Vagrant, Terraform, and legacy shell scripts
  • Legacy ansible/ directory, nested role subdirectories, and inventory scripts
  • Old build artifacts, workspace state files, and Packer templates
  • Obsolete docs and scenario data not relevant to the collection

Rationale:

This refactor transforms the GOAD lab into a modern, maintainable Ansible collection. All roles are now accessible via FQCNs, playbooks are organized for easy reuse, and legacy VM/provisioning code is removed. The new structure simplifies usage for cloud, local, and CI/CD deployments while aligning with best practices for Ansible Galaxy distribution.

…pdate paths

**Added:**

- Added `galaxy.yml` and `meta/runtime.yml` for Ansible Galaxy compatibility
- Created `changelogs/changelog.yaml` and `changelogs/config.yaml` for structured changelog tracking
- Added `roles/` directory with flattened role names (no nested directories)
- Added `plugins/modules/` for custom PowerShell modules used by roles
- Added `playbooks/` directory consolidating all playbooks and included missing playbooks from `ansible/`
- Added `README.md` with updated architecture and usage docs for the collection structure

**Changed:**

- Refactored all playbooks and role references to use fully qualified collection names (e.g., `dreadnode.goad.role`)
- Moved and flattened roles from `ansible/roles/` into `roles/` using single-depth names (e.g., `roles/settings/keyboard` → `roles/settings_keyboard`)
- Updated all references in playbooks to point to new `roles/` structure and FQCN style
- Moved custom modules from role `library/` directories to `plugins/modules/`
- Updated `.gitignore` for new build artifact and collection layout, removing obsolete ignores
- Refactored `Taskfile.yaml` to use new collection layout, updated paths for roles, playbooks, and artifacts
- Updated `requirements.yml` to reflect collection dependencies only (removed playbook-level requirements)
- Updated `scripts/check.sh`, `scripts/setup_*.sh` to reference new requirements and collection paths
- Updated `playbooks.yml` and all includes/imports to reference `playbooks/` directory and new role paths
- Updated all `import_playbook`, `include_role`, and role references for new structure and FQCN use
- Updated documentation in `README.md` to describe the collection, role/architecture, and usage patterns
- Updated all file paths in scripts and Taskfile to align with new flat structure

**Removed:**

- Removed all Python-based provisioner code (`goad.py`, `goad/`, and related submodules)
- Deleted Vagrant, Packer, and Terraform provider templates and scripts
- Removed legacy `packer/`, `template/`, and variant generation tooling
- Deleted old requirements and lock files (`requirements.txt`, `requirements_311.yml`, `pyproject.toml`, `poetry.lock`, etc.)
- Removed all non-Ansible build and environment files (e.g., `globalsettings.ini`, `.venv`, legacy scripts)
- Removed legacy `ansible/` directory in favor of `playbooks/` and `roles/`
- Removed all files related to non-Ansible provisioning (Python, shell scripts, variant generators)
- Removed deprecated provider support and playbooks no longer relevant to the collection

**Changed:**

- All role variable, playbook, and module references updated to match the new collection/role structure
- All playbooks, roles, and supporting files now reside in a structure compatible with Ansible Galaxy collections
- Windows, AWS, Azure, and other provider-specific code and templates removed or refactored to align with collection-only deployment
- Updated all usage and contribution documentation for the new layout and collection packaging

**Removed:**

- All legacy cloud provider provisioning templates, Vagrant, Packer, and Terraform files
- All variant generation and Python-based orchestration tooling
- Legacy build system and requirements for non-Ansible provisioning
- All workspace, lab manager, and instance orchestration code from the previous implementation
@dreadnode-renovate-bot dreadnode-renovate-bot Bot added area/taskfiles Changes made to taskfiles area/python Changes made to Python application code area/scripts Changes made to utility scripts area/readme Changes made to README.md file lab/GOAD Changes made to GOAD lab area/pre-commit Changes made to pre-commit hooks area/ad-labs Changes made to AD lab definitions area/packer Changes made to Packer configurations area/docker Changes made to Docker configurations lab/GOAD-Light Changes made to GOAD-Light lab labels Mar 31, 2026
l50 added 3 commits March 31, 2026 10:29
**Added:**

- GOAD Variant Generator - Introduced `tools/variant_generator`, a robust tool for
  generating graph-isomorphic GOAD variants with randomized names, realistic
  passwords, and consistent structural relationships. Includes comprehensive
  mapping, ordered text replacement, and validation logic.
- Packer/Proxmox Build Assets - Added a full set of Packer templates, answer
  files, scripts, and configuration examples for building Windows/Ubuntu VM
  templates on Proxmox. Supports Windows 10/2016/2019 variants with cloud-init
  and sysprep automation.
- New `requirements_311.yml` and `noansible_requirements.yml` for Python 3.11+
  and Docker-based builds.
- Poetry project configuration (`pyproject.toml`) and lockfile (`poetry.lock`)
  for reproducible Python builds.
- `requirements.txt` for pip-based installation.
- New Dockerfiles, entrypoint scripts (`goad.sh`, `goad_docker.sh`), and
  minimal keep files for proper build and workspace initialization.

**Changed:**

- Enhanced infrastructure-as-code support for Proxmox and Packer, including
  build scripts for ISO/answer file generation, cloudbase-init automation, and
  Windows update workflows.
- Updated project-level documentation and variant generator README for clear
  usage instructions and output expectations.

**Added (Packer/Proxmox specifics):**

- Proxmox answer files for Windows 10, 2016, 2019 (with/without updates)
- Cloudbase-init, sysprep, and autounattend scripts for Windows VM
  customization and cloud-init compatibility
- Shell and PowerShell scripts for network fixups, WinRM, screensaver,
  power plan, and autologon configuration
- Build automation for generating ISO images for Proxmox template builds
- Example variable and config templates for Proxmox environments

**Added (Variant Generator specifics):**

- Python modules for name generation, mapping, and graph-preserving
  transformation of GOAD lab structures
- Ordered replacement logic to avoid substring collision in entity renaming
- Validation routines to ensure no original names or domains remain in variants
- README and mapping documentation for generated variants

**Removed:**

- No removals; all changes are additive and backward compatible.
Move requirements.yml content to ansible/requirements.yml and merge
new collections (microsoft.ad, amazon.aws) from main.
**Changed:**

- Relocated all Ansible-related files (roles, playbooks, plugins, configs, etc.)
  into the `ansible/` directory for improved project structure and clarity
- Updated all references to playbooks, roles, requirements, and configuration
  files throughout scripts, documentation, and Python code to use the new
  `ansible/` path prefix
- Adjusted `.gitignore` entries for build artifacts to match new Ansible file
  locations
- Refactored Python provisioner logic to expect playbooks in `ansible/playbooks`
  and updated directory joins accordingly
- Updated CI, Dockerfile, and helper scripts to use `ansible/requirements.yml`
  and `ansible/playbooks/` paths
- Modified role metadata files to include company, descriptive summaries, and
  relevant `galaxy_tags` for improved Ansible Galaxy integration
- Rewrote `ansible/requirements_311.yml` to be a Python requirements file
  instead of an Ansible collection requirements file
- Removed now-obsolete or duplicate files from the project root that were
  moved or made redundant by the new structure

**Removed:**

- Deleted the old `requirements_311.yml` and duplicate role metadata files
  from their previous locations
- Removed the `roles/settings_gpmc/README.md` file (documentation now
  consolidated or moved)

**Added:**

- Added a new `ansible/roles/elk/meta/main.yml` with improved metadata and
  tags for the ELK role

**Why:**

- Centralizing Ansible artifacts under `ansible/` improves maintainability,
  discoverability, and supports clearer automation and packaging workflows
- Enhances metadata for easier Ansible Galaxy publishing and more informative
  documentation for users and contributors
@dreadnode-renovate-bot dreadnode-renovate-bot Bot added area/github Changes made to github actions area/playbooks Changes made to playbooks directory area/roles Changes made to Ansible roles area/docs Changes made to documentation labels Mar 31, 2026
l50 added 8 commits March 31, 2026 11:09
… files

**Added:**

- Added README documentation for the new `settings_gpmc` role, describing how
  to install Group Policy Management Console and providing example usage

**Changed:**

- Standardized the "Description" section in all role README.md files to provide
  clear, concise summaries of each role's functionality
- Updated company metadata in all roles to consistently attribute "Dreadnode"
  as the company
- Changed license metadata in applicable roles to consistently use
  "GPL-3.0-or-later"
- Improved and corrected platform compatibility sections, specifying "Windows:
  all", "Ubuntu: all", or "Debian: all" as appropriate
- Fixed typos and clarified descriptions in multiple roles for accuracy and
  professionalism (e.g., correcting "disaule user" to "Disable an Active
  Directory user account", "memuer server" to "Join a Windows server to an
  Active Directory domain", etc.)
- Updated Ansible version requirements and clarified supported platforms for
  auditing and logging roles (e.g., `dc_audit_sacl`, `ldap_diagnostic_logging`,
  `mssql_audit`, `elk`)
- Enhanced readability and consistency throughout all role documentation files
…aths

The pre-commit workflow needs the collection installed for ansible-lint
to resolve dreadnode.goad.* roles. Also updates ansible-lint exclude
paths for the ansible/ subdirectory move.
test: add molecule syntax-check scenarios for all roles and CI workflow


**Added:**

- Introduced `molecule` test scenarios (converge.yml and molecule.yml) for all
  roles under `ansible/roles`, supporting syntax-check only for Windows and
  infrastructure-dependent roles
- Created a reusable converge playbook in each role to allow `molecule syntax`
  validation, including the appropriate role under test
- Added `molecule.yaml` GitHub Actions workflow to automate syntax-checks for
  all roles, supporting event triggers (push, PR, schedule, workflow dispatch)
  and matrix builds for efficiency
- Implemented role selection and validation logic in the workflow for targeted
  testing of changed roles or manual dispatch

**Changed:**

- No existing files were changed; all additions are new files to enable syntax
  checking and CI automation for Ansible roles

**Removed:**

- No files were removed
…update SSM config

**Added:**

- Added `check-ansible-version` Taskfile task to enforce compatible ansible-core
  version for AWS SSM Windows connections
- Declared `amazon.aws` dependency in `ansible/galaxy.yml` for explicit collection
  requirement

**Changed:**

- Updated ansible-core version pin in `requirements.txt`, `requirements_311.yml`,
  and `meta/runtime.yml` to `>=2.17.0,<2.18.0` with detailed comments explaining
  SSM pipelining bug in 2.19+
- Updated Taskfile `provision` task to depend on `check-ansible-version` for
  safety
- Updated SSM connection plugin usage in inventories from `aws_ssm` to
  `amazon.aws.aws_ssm` to match current collection namespace
- Adjusted inventory `data_path` to use correct relative path
- Updated ansible.cfg and meta/runtime.yml with clear warnings about the version
  constraint and SSM bug
- Changed `ansible/playbooks/data.yml` to use
  `ansible_connection is search('aws_ssm')` for broader compatibility
- Updated playbooks and extension install.yml files to use new data import path
  and remove unnecessary `vars: data_path`
- Updated `script_path` and file path variables in playbooks and roles to use
  `{{ playbook_dir }}` for correct relative referencing
- Switched `vulns_disable_firewall` role to use PowerShell command for firewall
  disabling due to module issues

**Removed:**

- Removed explicit `vars: data_path` from playbooks' data import as it is no
  longer necessary with updated path handling
**Changed:**

- Fixed conditional block in Molecule workflow to ensure proper error handling
  and script termination when a test fails. Added missing `fi` to close the
  conditional statement in `.github/workflows/molecule.yaml`.
…tation

**Changed:**

- Updated documentation to reference `ansible.windows.win_powershell` instead of
  `ansible.windows.win_firewall` for disabling the Domain firewall in
  `main.yml`, clarifying the implementation method for users
…flow

**Changed:**

- Fixes quoting around bash command substitution when extracting role name from
  molecule directory in the CI workflow, preventing potential errors with
  directory names containing spaces or special characters in
  `.github/workflows/molecule.yaml`
…d clean up molecule configs

**Added:**

- Introduced a new GitHub Actions workflow `.github/workflows/syntax-check.yaml` for
  running Ansible syntax checks on roles, with automatic detection of changed roles
  and support for manual role selection

**Changed:**

- Updated `.hooks/gen-arch-diagram.py` to remove molecule-specific role/playbook
  analysis and to use the correct root directory for analysis
- Modified `ansible/galaxy.yml` to exclude all `roles/*/molecule` directories from
  collection build
- Cleaned up `.hooks/requirements.txt` by removing Molecule and Docker-related
  dependencies

**Removed:**

- Removed the Molecule test workflow `.github/workflows/molecule.yaml` and all
  Molecule scenario directories under each role (e.g., `roles/*/molecule`), including
  converge playbooks and molecule configuration files, as these are no longer used
  for validation or testing
@l50 l50 merged commit 7836522 into main Mar 31, 2026
5 checks passed
@l50 l50 deleted the worktree-ansible-collection-v2 branch March 31, 2026 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ad-labs Changes made to AD lab definitions area/docker Changes made to Docker configurations area/docs Changes made to documentation area/github Changes made to github actions area/packer Changes made to Packer configurations area/playbooks Changes made to playbooks directory area/pre-commit Changes made to pre-commit hooks area/python Changes made to Python application code area/readme Changes made to README.md file area/roles Changes made to Ansible roles area/scripts Changes made to utility scripts area/taskfiles Changes made to taskfiles lab/GOAD Changes made to GOAD lab lab/GOAD-Light Changes made to GOAD-Light lab

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant