diff --git a/cloud/setup.yml b/cloud/setup.yml index 0023f2d3a..6a8b9001f 100644 --- a/cloud/setup.yml +++ b/cloud/setup.yml @@ -266,62 +266,6 @@ controller_templates: variable: create_vm_vm_name required: true - - name: Cloud | AWS | Delete VPC - labels: - - aws.vpc - job_type: run - organization: Ansible Product Demos (APD) - credentials: - - AWS - project: Ansible Product Demos - playbook: cloud/delete_vpc.yml - inventory: Ansible Product Demos Inventory - notification_templates_started: Telemetry - notification_templates_success: Telemetry - notification_templates_error: Telemetry - survey_enabled: true - survey: - name: '' - description: '' - spec: - - question_name: AWS Region - type: multiplechoice - variable: create_vm_aws_region - required: true - choices: - - us-east-1 - - us-east-2 - - us-west-1 - - us-west-2 - - - name: Cloud | AWS | Delete Keypair - labels: - - aws.ec2 - job_type: run - organization: Ansible Product Demos (APD) - credentials: - - AWS - project: Ansible Product Demos - playbook: cloud/delete_keypair.yml - inventory: Ansible Product Demos Inventory - notification_templates_started: Telemetry - notification_templates_success: Telemetry - notification_templates_error: Telemetry - survey_enabled: true - survey: - name: '' - description: '' - spec: - - question_name: AWS Region - type: multiplechoice - variable: create_vm_aws_region - required: true - choices: - - us-east-1 - - us-east-2 - - us-west-1 - - us-west-2 - - name: Cloud | AWS | Patch Pre-check RHEL labels: - aws.ec2 diff --git a/common/setup.yml b/common/setup.yml index 1f0673295..eda0fd65b 100644 --- a/common/setup.yml +++ b/common/setup.yml @@ -253,6 +253,62 @@ controller_templates: public key is derived automatically. Otherwise paste the full public key line (for example, from ~/.ssh/id_rsa.pub). + - name: Cloud | AWS | Delete Keypair + labels: + - aws.ec2 + job_type: run + organization: Ansible Product Demos (APD) + credentials: + - AWS + project: Ansible Product Demos + playbook: cloud/delete_keypair.yml + inventory: Ansible Product Demos Inventory + notification_templates_started: Telemetry + notification_templates_success: Telemetry + notification_templates_error: Telemetry + survey_enabled: true + survey: + name: '' + description: '' + spec: + - question_name: AWS Region + type: multiplechoice + variable: create_vm_aws_region + required: true + choices: + - us-east-1 + - us-east-2 + - us-west-1 + - us-west-2 + + - name: Cloud | AWS | Delete VPC + labels: + - aws.vpc + job_type: run + organization: Ansible Product Demos (APD) + credentials: + - AWS + project: Ansible Product Demos + playbook: cloud/delete_vpc.yml + inventory: Ansible Product Demos Inventory + notification_templates_started: Telemetry + notification_templates_success: Telemetry + notification_templates_error: Telemetry + survey_enabled: true + survey: + name: '' + description: '' + spec: + - question_name: AWS Region + type: multiplechoice + variable: create_vm_aws_region + required: true + choices: + - us-east-1 + - us-east-2 + - us-west-1 + - us-west-2 + - name: Cloud | AWS | Create VM labels: - aws.ec2 diff --git a/docs/_data/demos.yml b/docs/_data/demos.yml index b1d4a1706..8e7f1af1d 100644 --- a/docs/_data/demos.yml +++ b/docs/_data/demos.yml @@ -1012,6 +1012,48 @@ style M fill:#4a1a1a,stroke:#ef4444,color:#fff style S fill:#212427,stroke:#8a8d90,color:#fff +- slug: windows-destroy-ad-domain + readme_path: windows/docs/windows-destroy-ad-domain.md + title: "Destroy Active Directory Domain" + category: windows + status: active + is_workflow: true + tags: + - Workflow + - Survey + - Active Directory + - AWS + thumbnail: + gradient: "linear-gradient(135deg, #dc2626 0%, #7f1d1d 100%)" + icon: "💥" + blurb: "Tear down the domain controller, both domain-joined hosts, VPC, and keypair created by Setup Active Directory Domain, reset AD credentials, and sync inventory." + stats: + workflows: 1 + playbooks: 5 + url: /demos/windows-destroy-ad-domain/ + github_path: windows/setup.yml + workflow_mermaid: | + graph LR + S["🏠 Start"] + S --> A + S --> B + S --> C + S --> D + A["💥 Delete dc01"] --> F["🔄 Sync Inventory"] + B["💥 Delete winston"] --> F + C["💥 Delete winthrop"] --> F + D["🔧 Reset AD Configuration"] --> F + F --> G["🔑 Delete Keypair"] + F --> H["🌐 Delete VPC"] + style A fill:#4a1a1a,stroke:#ef4444,color:#fff + style B fill:#4a1a1a,stroke:#ef4444,color:#fff + style C fill:#4a1a1a,stroke:#ef4444,color:#fff + style D fill:#2d1f4e,stroke:#a78bfa,color:#fff + style F fill:#2d2d2d,stroke:#888,color:#fff + style G fill:#1e3a5f,stroke:#4a90d9,color:#fff + style H fill:#1e3a5f,stroke:#4a90d9,color:#fff + style S fill:#212427,stroke:#8a8d90,color:#fff + # ─── Network ──────────────────────────────────────────────────────── - slug: network-deploy-containerlab-stack diff --git a/windows/README.md b/windows/README.md index a4651e26f..9b0be3b99 100644 --- a/windows/README.md +++ b/windows/README.md @@ -25,6 +25,7 @@ We are currently investigating an intermittent connectivity issue related to the | Workflow | Description | |----------|-------------| | [**Setup Active Directory Domain**](docs/windows-setup-ad-domain.md) | One-click workflow to provision a domain controller and two domain-joined Windows hosts in AWS, including Kerberos validation. | +| [**Destroy Active Directory Domain**](docs/windows-destroy-ad-domain.md) | Tear down the domain controller and both domain-joined hosts created by Setup, reset Kerberos and AD LDAP credentials, and delete the keypair and VPC. | ### Jobs diff --git a/windows/docs/README.md b/windows/docs/README.md index f84b43312..4764e5453 100644 --- a/windows/docs/README.md +++ b/windows/docs/README.md @@ -19,3 +19,4 @@ Each file in this folder documents a corresponding windows demo playbook or work | AD — New User | [windows-ad-new-user.md](windows-ad-new-user.md) | [`windows/helpdesk_new_user_portal.yml`](../helpdesk_new_user_portal.yml) | | DISA STIG | [windows-disa-stig.md](windows-disa-stig.md) | [`windows/compliance.yml`](../compliance.yml) | | Setup Active Directory Domain | [windows-setup-ad-domain.md](windows-setup-ad-domain.md) | [`windows/setup.yml`](../setup.yml) | +| Destroy Active Directory Domain | [windows-destroy-ad-domain.md](windows-destroy-ad-domain.md) | [`windows/setup.yml`](../setup.yml) | diff --git a/windows/docs/windows-destroy-ad-domain.md b/windows/docs/windows-destroy-ad-domain.md new file mode 100644 index 000000000..002826a62 --- /dev/null +++ b/windows/docs/windows-destroy-ad-domain.md @@ -0,0 +1,69 @@ +# Destroy Active Directory Domain + + +Tears down everything created by Setup Active Directory Domain — terminates the domain controller and both domain-joined computers in parallel, resets the Kerberos and AD LDAP credentials to placeholder values, re-syncs the AWS dynamic inventory, and deletes the keypair and VPC. + +## Workflow + +```mermaid +graph LR + S["🏠 Start"] + S --> A + S --> B + S --> C + S --> D + A["💥 Delete dc01"] --> F["🔄 Sync Inventory"] + B["💥 Delete winston"] --> F + C["💥 Delete winthrop"] --> F + D["🔧 Reset AD Configuration"] --> F + F --> G["🔑 Delete Keypair"] + F --> H["🌐 Delete VPC"] + style S fill:#212427,stroke:#8a8d90,color:#fff +``` + +1. Terminates dc01, winston, and winthrop **in parallel** +2. Resets the Kerberos and AD LDAP credentials to `REPLACEME` placeholders (runs concurrently with the VM deletions since it only touches Controller, not AWS). The AD LDAP inventory source itself is left in place — it's a standing resource referenced directly by the Setup workflow's AD LDAP Inventory Sync node — but with placeholder credentials, it can no longer authenticate against a real domain controller. +3. Syncs AWS inventory so hosts are removed from AAP +4. Deletes keypair `aws-test-key` and VPC `aws-test-vpc` (and related resources: subnet, route table, internet gateway, security group) **in parallel** + +## Prerequisites + +- An AD domain previously deployed with **Setup Active Directory Domain** +- AWS credential configured +- **AAP Credential** for Controller API callbacks when resetting AD resources + +## Survey prompts + +| Prompt | Variable | Type | Required | +|--------|----------|------|----------| +| AWS Region | `create_vm_aws_region` | multiplechoice | Yes | + +## Job templates + +| Template | Playbook | Description | +|----------|----------|-------------| +| Cloud ǀ AWS ǀ Delete VM | [`cloud/delete_vm_by_name.yml`](../../cloud/delete_vm_by_name.yml) | Terminates dc01, winston, and winthrop by Name tag | +| WINDOWS ǀ AD ǀ Reset Configuration | [`windows/reset_ad_configuration.yml`](../reset_ad_configuration.yml) | Resets the Kerberos and AD LDAP credentials to placeholders | +| AWS Inventory | `(inventory sync)` | Re-syncs the AWS dynamic inventory so the deleted hosts are removed from AAP | +| Cloud ǀ AWS ǀ Delete Keypair | [`cloud/delete_keypair.yml`](../../cloud/delete_keypair.yml) | Deletes the `aws-test-key` keypair | +| Cloud ǀ AWS ǀ Delete VPC | [`cloud/delete_vpc.yml`](../../cloud/delete_vpc.yml) | Deletes the VPC and related networking resources | + +## Presenter walkthrough + +1. **When to use:** Run this at the end of a demo session, or whenever you need a clean slate before running Setup Active Directory Domain again. It's safe to run even if some resources are already gone. +2. **Launch:** Select the same AWS region used for Setup. The workflow handles everything else. +3. **Watch the parallel teardown:** The three VMs terminate simultaneously while the Kerberos and AD LDAP credentials reset to placeholders — no credentials are left pointing at a domain controller that no longer exists. +4. **Wrap-up:** VPC and keypair cleanup happen last, once inventory sync confirms the hosts are gone. + +## Talking points + +- This is the matching teardown for Setup Active Directory Domain — AAP-side credentials are returned to their pristine, pre-setup state, not left pointing at a terminated domain controller. +- Resetting the Kerberos and AD LDAP credentials to placeholders (rather than leaving them pointing at a deleted domain controller) avoids confusing failures the next time someone inspects or runs against them. +- The AD LDAP Inventory source and inventory container are standing resources — they're referenced directly by the Setup workflow's own node definitions, so they're never deleted. Resetting the credentials they depend on is what keeps the Setup/Destroy lifecycle safe to run repeatedly. + +## Related demos + +| Demo | Description | +|------|-------------| +| 🏰 [Setup Active Directory Domain](./windows-setup-ad-domain.md) | The matching provisioning workflow | +| 💥 [Destroy Cloud Stack in AWS](../../cloud/docs/cloud-destroy-stack.md) | The equivalent teardown workflow for the general-purpose cloud stack | diff --git a/windows/docs/windows-setup-ad-domain.md b/windows/docs/windows-setup-ad-domain.md index 5a4afbd15..861390ca5 100644 --- a/windows/docs/windows-setup-ad-domain.md +++ b/windows/docs/windows-setup-ad-domain.md @@ -32,7 +32,7 @@ graph LR 1. **Create Keypair + VPC** — Provisions AWS infrastructure 2. **Create VMs** (parallel) — Deploys one domain controller and two domain computers 3. **Inventory Sync + Test Connectivity** — Verifies all three VMs are reachable -4. **Create Domain** — Promotes the DC to a domain controller +4. **Create Domain** — Promotes the DC to a domain controller and updates the Kerberos and AD LDAP credentials with its connection info 5. **Join Domain** — Joins the two computers to the new domain 6. **Inventory Sync** (parallel) — Refreshes the AWS dynamic inventory and the AD LDAP inventory to pick up domain membership 7. **Validation** (parallel) — Tests PowerShell and Kerberos authentication @@ -42,8 +42,7 @@ On any failure, the **Cleanup Resources** rollback node runs automatically. ## Prerequisites - AWS credential configured with Access and Secret key -- SSH public key for AWS keypair creation -- **APD Machine Credential** with Windows administrator credentials +- **APD Machine Credential** with Windows administrator credentials and an SSH private key (Create Keypair derives the public key from it) - **AAP Credential** for Controller API callbacks during domain creation ## Survey prompts @@ -51,7 +50,6 @@ On any failure, the **Cleanup Resources** rollback node runs automatically. | Prompt | Variable | Type | Required | |--------|----------|------|----------| | AWS Region | `create_vm_aws_region` | multiplechoice | Yes | -| Keypair Public Key | `aws_public_key` | textarea | Yes | | Owner | `create_vm_vm_owner` | text | Yes | | Environment | `create_vm_vm_environment` | multiplechoice | Yes | | Subnet | `create_vm_aws_vpc_subnet_name` | text | Yes | @@ -68,7 +66,7 @@ On any failure, the **Cleanup Resources** rollback node runs automatically. | Cloud ǀ AWS ǀ Create VM (Computer 2 - winthrop) | [`cloud/create_vm.yml`](../../cloud/create_vm.yml) | Deploys the winthrop Windows Server instance as domain computer | | AWS Inventory | `(inventory sync)` | Syncs the AWS dynamic inventory to import the new VMs | | WINDOWS ǀ Test Connectivity | [`windows/connect.yml`](../connect.yml) | Validates WinRM connectivity to all three Windows hosts | -| WINDOWS ǀ AD ǀ Create Domain | [`windows/create_ad_domain.yml`](../create_ad_domain.yml) | Promotes dc01 to domain controller and creates the ANSIBLE.LOCAL domain | +| WINDOWS ǀ AD ǀ Create Domain | [`windows/create_ad_domain.yml`](../create_ad_domain.yml) | Promotes dc01 to domain controller, creates the ANSIBLE.LOCAL domain, and updates the Kerberos and AD LDAP credentials with dc01's connection info | | WINDOWS ǀ AD ǀ Join Domain | [`windows/join_ad_domain.yml`](../join_ad_domain.yml) | Joins winston and winthrop to the Active Directory domain | | AWS Inventory (Post-Join) | `(inventory sync)` | Re-syncs the AWS dynamic inventory after domain join | | AD LDAP Inventory | `(inventory sync)` | Syncs the AD LDAP inventory via `microsoft.ad.ldap` to discover domain-joined hosts | @@ -108,6 +106,7 @@ On any failure, the **Cleanup Resources** rollback node runs automatically. | Demo | Description | |------|-------------| +| 💥 [Destroy Active Directory Domain](./windows-destroy-ad-domain.md) | Tear down everything this workflow creates | | 🪟 [AD — New User](./windows-ad-new-user.md) | Create users in the domain built by this workflow for a helpdesk self-service demo | | 🪟 [Patching](./windows-patching.md) | Patch the domain-joined Windows hosts to show day-2 operations | | 🚀 [Deploy Cloud Stack in AWS](../../cloud/docs/deploy-cloud-stack.md) | The general-purpose infrastructure provisioning workflow for mixed OS environments | diff --git a/windows/reset_ad_configuration.yml b/windows/reset_ad_configuration.yml new file mode 100644 index 000000000..f2a38e69c --- /dev/null +++ b/windows/reset_ad_configuration.yml @@ -0,0 +1,26 @@ +--- +- name: Reset AD Controller configuration to placeholders + hosts: localhost + gather_facts: false + + tasks: + - name: Reset Kerberos Credential + ansible.controller.credential: + name: Kerberos Credential + credential_type: Kerberos + organization: Ansible Product Demos (APD) + inputs: + username: ec2-user@ANSIBLE.LOCAL + password: REPLACEME + default_realm: ANSIBLE.LOCAL + kdc: REPLACEME + + - name: Reset Microsoft AD LDAP Credential + ansible.controller.credential: + name: Microsoft AD LDAP Credential + credential_type: Microsoft AD LDAP + organization: Ansible Product Demos (APD) + inputs: + username: ec2-user@ANSIBLE.LOCAL + password: REPLACEME + server: REPLACEME diff --git a/windows/setup.yml b/windows/setup.yml index 3b00cbbe4..9021e7228 100644 --- a/windows/setup.yml +++ b/windows/setup.yml @@ -109,6 +109,8 @@ controller_inventories: - name: Windows AD Inventory organization: Ansible Product Demos (APD) description: Hosts discovered from Active Directory via microsoft.ad.ldap + variables: + DISCLAIMER: RUN SETUP ACTIVE DIRECTORY DOMAIN BEFORE SYNCING # Disable AD inventory sync during setup; dependent on Setup Active Directory Domain workflow aap_configuration_dispatcher_exclude_roles: [controller_inventory_source_update] @@ -123,6 +125,8 @@ controller_inventory_sources: overwrite: true update_on_launch: false update_on_project_update: false + source_vars: + DISCLAIMER: RUN SETUP ACTIVE DIRECTORY DOMAIN BEFORE SYNCING controller_templates: - name: "WINDOWS | Install IIS" @@ -426,6 +430,19 @@ controller_templates: variable: _hosts required: false + - name: "WINDOWS | AD | Reset Configuration" + labels: + - windows + job_type: run + inventory: Ansible Product Demos Inventory + project: "Ansible Product Demos" + playbook: "windows/reset_ad_configuration.yml" + notification_templates_started: Telemetry + notification_templates_success: Telemetry + notification_templates_error: Telemetry + credentials: + - AAP Credential + - name: "WINDOWS | AD | Join Domain" labels: - windows @@ -552,14 +569,6 @@ controller_workflows: - us-east-2 - us-west-1 - us-west-2 - - question_name: Keypair Public Key - type: textarea - variable: aws_public_key - required: false - question_description: >- - Optional when APD Machine Credential includes an SSH private key — the - public key is derived automatically. Otherwise paste the full public key - line (for example, from ~/.ssh/id_rsa.pub). # Create VM variables - question_name: Owner type: text @@ -685,3 +694,67 @@ controller_workflows: job_type: run extra_data: ps_script: "Get-WinEvent -LogName Security | Where-Object {$_.Message -like '*Kerberos*'} | Select-Object TimeCreated, Message -First 1" + + - name: Destroy Active Directory Domain + description: Tear down the AD domain VMs, VPC, and keypair created by Setup Active Directory Domain + labels: + - aws.ec2 + - aws.vpc + - windows + organization: Ansible Product Demos (APD) + notification_templates_started: Telemetry + notification_templates_success: Telemetry + notification_templates_error: Telemetry + survey_enabled: true + survey: + name: '' + description: '' + spec: + - question_name: AWS Region + question_description: >- + AWS region where the AD domain stack was deployed. + type: multiplechoice + variable: create_vm_aws_region + required: true + default: us-east-2 + choices: + - us-east-1 + - us-east-2 + - us-west-1 + - us-west-2 + simplified_workflow_nodes: + - identifier: Delete Domain Controller + unified_job_template: Cloud | AWS | Delete VM + extra_data: + create_vm_vm_name: dc01 + success_nodes: + - Update Inventory + - identifier: Delete Computer 1 + unified_job_template: Cloud | AWS | Delete VM + extra_data: + create_vm_vm_name: winston + success_nodes: + - Update Inventory + - identifier: Delete Computer 2 + unified_job_template: Cloud | AWS | Delete VM + extra_data: + create_vm_vm_name: winthrop + success_nodes: + - Update Inventory + - identifier: Reset AD Configuration + unified_job_template: WINDOWS | AD | Reset Configuration + job_type: run + success_nodes: + - Update Inventory + - identifier: Update Inventory + unified_job_template: AWS Inventory + all_parents_must_converge: true + success_nodes: + - Delete Keypair + - Delete VPC + - identifier: Delete Keypair + unified_job_template: Cloud | AWS | Delete Keypair + all_parents_must_converge: true + - identifier: Delete VPC + unified_job_template: Cloud | AWS | Delete VPC + all_parents_must_converge: true