This is an Ansible Validated Content collection — a reference implementation that demonstrates best practices for automating STIG compliance workflows with Ansible.
What this means for contributors:
- This collection serves as a baseline that partners and vendors can use to build their own customizations, extend platform support, or learn from the patterns.
- Contributions that improve the reference implementation (new STIG rules, new platforms, bug fixes, documentation) are welcome via pull requests.
- The specs-driven approach (
docs/specs/) is used to validate whether structured specifications can generate high-quality Ansible validated content code, and whether agent skills (.agents/skills/) can help partners and vendors extend collection capabilities. - All contributions must meet the validated content quality bar: production-grade linting, full test coverage, argument specs, and idempotent remediation.
# Clone the repository
git clone https://github.com/redhat-cop/network.compliance.git
cd network.compliance
# Install ansible-dev-tools (bundles ansible-lint, molecule, tox, pytest, ade, and more)
pip install ansible-dev-tools
# Create isolated virtual environment with collection installed in editable mode
ade install -e . --venv .venv
source .venv/bin/activate
# Verify setup
ansible-galaxy collection list | grep network.compliance
adt --versionThe ade install -e . command:
- Creates a Python virtual environment at
.venv/ - Installs
ansible-coreand all collection dependencies (cisco.ios,ansible.utils, etc.) - Installs Python dependencies from
requirements.txt(jmespath,xmltodict) - Symlinks the collection source so edits are reflected immediately
- Configures
ansible.cfgfor workspace isolation
Fallback if ade install fails (e.g., Galaxy API unreachable):
python -m venv .venv
source .venv/bin/activate
pip install ansible-dev-tools
pip install -r requirements.txt
ansible-galaxy collection install -r requirements.yml --force 2>/dev/null || trueThis repository supports agentic development via Agent Skills. Skills are auto-discovered from .agents/skills/ by Claude Code, Cursor, GitHub Copilot, VS Code, and other compatible tools.
Before writing code, produce documentation first:
- Research — investigate the problem space and document findings in
docs/research/NNNN-<topic>.md(usedocs/research/template.md) - ADR — if your change involves an architecture or design decision, record it in
docs/adr/NNNN-<decision>.md(usedocs/adr/template.md) - Spec — write or update a spec in
docs/specs/NNNN-<feature>.mdwith goal, design, file manifest, acceptance criteria, and verification steps (usedocs/specs/template.md) - Review and approve — get spec approval before implementation begins
Then implement using the appropriate skill:
| Task | Skill | Location |
|---|---|---|
| Set up dev environment | dev-environment-setup |
.agents/skills/dev-environment-setup/SKILL.md |
| Add a STIG rule | stig-rule-development |
.agents/skills/stig-rule-development/SKILL.md |
| Write tests | compliance-testing |
.agents/skills/compliance-testing/SKILL.md |
| Add a platform | platform-onboarding |
.agents/skills/platform-onboarding/SKILL.md |
| Review a PR | collection-review |
.agents/skills/collection-review/SKILL.md |
- Research and spec — document the problem, produce an ADR if needed, write or update a spec
- Pick a STIG rule — identify the V-key, STIG ID, and severity from the DISA STIG Library
- Implement — follow the workflow in
.agents/skills/stig-rule-development/SKILL.md - Test — write a Molecule scenario covering both compliant and non-compliant states
- Lint — ensure
tox -e lintpasses before submitting
# Auto-fix all lint and format issues
tox -e fix
# Run all CI checks (recommended before pushing)
tox -e ci
# Individual checks
tox -e lint # ansible-lint
tox -e unit # unit tests (filter plugins)
tox -e ruff # Python lint + format
tox -e sanity # ansible-test sanity (requires Docker)
tox -e gitleaks # secret scanning
tox -e molecule # all Molecule scenarios
# Set up pre-commit hooks (runs checks on every commit)
pre-commit install- File extensions:
.yamlfor YAML,.j2for Jinja2 templates - Module references: always use FQCNs (
cisco.ios.ios_config, notios_config) - Task names:
STIG | <STIG_ID> | <V-key> | <severity> | <description> - Tags: every task tagged with STIG ID, V-key, Rule ID, severity, CCI
- Variables:
compliance_prefix for user-facing,_prefix for internal - Error handling:
block/rescueinstead ofignore_errors: true - Sensitive values:
no_log: trueon passwords, keys, communities - Line length: 160 characters max
- STIG metadata verified against official DISA XCCDF source
- Rule metadata added to
evaluate/vars/stig/<platform>/catN.yaml - Task names and tags follow conventions
- FQCNs used for all modules
-
check_modeworks for evaluate tasks - Remediation is idempotent
-
no_logon sensitive values -
argument_specs.ymlupdated - Molecule scenario added (pass + fail cases)
- Changelog fragment in
changelogs/fragments/ -
tox -e cipasses locally