diff --git a/cloud/create_vpc.yml b/cloud/create_vpc.yml index 30759b765..5b96c62cf 100644 --- a/cloud/create_vpc.yml +++ b/cloud/create_vpc.yml @@ -73,6 +73,7 @@ - 22 # SSH - 5986 # WinRM - 88 # Kerberos Authentication + - 389 # LDAP - 3389 # RDP - 9090 # Cockpit - 9095 # Kafka EDA external listener (aws_kafka config drift) diff --git a/docs/_data/demos.yml b/docs/_data/demos.yml index b36cc9902..b154dbeb8 100644 --- a/docs/_data/demos.yml +++ b/docs/_data/demos.yml @@ -989,9 +989,10 @@ F --> G["๐Ÿ”Œ Test Connectivity"] G --> H["๐Ÿฐ Create Domain"] H --> I["๐Ÿค Join Domain"] - I --> J["๐Ÿ”„ Domain Inventory Sync"] + I --> J["๐Ÿ”„ AWS Inventory Sync"] + I --> N["๐Ÿ”„ AD LDAP Inventory Sync"] J --> K["โšก PowerShell Validation"] - J --> L["๐Ÿ” Kerberos Validation"] + N --> L["๐Ÿ” Kerberos Validation"] G -. "any failure" .-> M["๐Ÿงน Cleanup Resources"] H -. "any failure" .-> M I -. "any failure" .-> M @@ -1005,6 +1006,7 @@ style H fill:#2d1f4e,stroke:#a78bfa,color:#fff style I fill:#2d1f4e,stroke:#a78bfa,color:#fff style J fill:#2d2d2d,stroke:#888,color:#fff + style N fill:#2d2d2d,stroke:#888,color:#fff style K fill:#162c46,stroke:#58a6ff,color:#fff style L fill:#162c46,stroke:#58a6ff,color:#fff style M fill:#4a1a1a,stroke:#ef4444,color:#fff diff --git a/windows/create_ad_domain.yml b/windows/create_ad_domain.yml index c35743980..e1c71038f 100644 --- a/windows/create_ad_domain.yml +++ b/windows/create_ad_domain.yml @@ -84,3 +84,15 @@ password: "{{ ansible_password }}" default_realm: "{{ domain_name | upper }}" kdc: "{{ ansible_host }}" + + - name: Update Microsoft AD LDAP Credential + run_once: true + delegate_to: localhost + ansible.controller.credential: + name: Microsoft AD LDAP Credential + credential_type: Microsoft AD LDAP + organization: Ansible Product Demos (APD) + inputs: + username: "{{ ansible_user }}@{{ domain_name | upper }}" + password: "{{ ansible_password }}" + server: "{{ ansible_host }}" diff --git a/windows/docs/windows-setup-ad-domain.md b/windows/docs/windows-setup-ad-domain.md index 77f0abbbd..5a4afbd15 100644 --- a/windows/docs/windows-setup-ad-domain.md +++ b/windows/docs/windows-setup-ad-domain.md @@ -19,9 +19,10 @@ graph LR F --> G["๐Ÿ”Œ Test Connectivity"] G --> H["๐Ÿฐ Create Domain"] H --> I["๐Ÿค Join Domain"] - I --> J["๐Ÿ”„ Domain Inventory Sync"] + I --> J["๐Ÿ”„ AWS Inventory Sync"] + I --> N["๐Ÿ”„ AD LDAP Inventory Sync"] J --> K["โšก PowerShell Validation"] - J --> L["๐Ÿ” Kerberos Validation"] + N --> L["๐Ÿ” Kerberos Validation"] G -. "any failure" .-> M["๐Ÿงน Cleanup Resources"] H -. "any failure" .-> M I -. "any failure" .-> M @@ -33,7 +34,8 @@ graph LR 3. **Inventory Sync + Test Connectivity** โ€” Verifies all three VMs are reachable 4. **Create Domain** โ€” Promotes the DC to a domain controller 5. **Join Domain** โ€” Joins the two computers to the new domain -6. **Validation** (parallel) โ€” Tests PowerShell and Kerberos authentication +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 On any failure, the **Cleanup Resources** rollback node runs automatically. @@ -68,6 +70,8 @@ On any failure, the **Cleanup Resources** rollback node runs automatically. | 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 ว€ 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 | | WINDOWS ว€ Run PowerShell (Validation) | [`windows/powershell.yml`](../powershell.yml) | Runs Get-ADComputer on the domain controller to list joined computers | | WINDOWS ว€ Run PowerShell ว€ Kerberos (Validation) | [`windows/powershell.yml`](../powershell.yml) | Validates Kerberos authentication by querying Security event logs | | WINDOWS ว€ Rollback (Cleanup) | [`windows/rollback.yml`](../rollback.yml) | Cleans up resources if any workflow step fails | @@ -94,6 +98,9 @@ On any failure, the **Cleanup Resources** rollback node runs automatically. - This is a complete infrastructure-to-validation workflow. It provisions VMs, configures Active Directory, and proves it works โ€” all in one click. - Parallel VM creation with dependency management is a key AAP workflow feature. Three VMs deploy simultaneously, but domain join waits for all three to be ready. - The automatic cleanup on failure means you never leave orphaned resources in AWS. If domain creation fails, everything rolls back. +- Two inventory sync paths included: + - amazon.aws.ec2 - dynamic group creation using tags for domain specific roles + - microsoft.ad.ldap - demonstrate leveraging the ldap plugin to generate an inventory from Active Directory - Kerberos validation is the real proof โ€” it shows the domain is functional, not just provisioned. - After this workflow completes, you can pivot to the Helpdesk New User demo to show AD user management. diff --git a/windows/inventory.microsoft.ad.ldap.yml b/windows/inventory.microsoft.ad.ldap.yml new file mode 100644 index 000000000..de378286e --- /dev/null +++ b/windows/inventory.microsoft.ad.ldap.yml @@ -0,0 +1,27 @@ +--- +plugin: microsoft.ad.ldap +# Connection secrets are not set here; they are supplied via environment +# variables injected by the "Microsoft AD LDAP" credential +# server <- MICROSOFT_AD_LDAP_SERVER +# username <- MICROSOFT_AD_LDAP_USERNAME (secret) +# password <- MICROSOFT_AD_LDAP_PASSWORD (secret) +auth_protocol: ntlm +search_base: DC=ansible,DC=local +search_scope: subtree +attributes: + sAMAccountName: + sam_account_name: + objectSid: + object_sid: + operatingSystem: + operating_system: +compose: + ansible_connection: "'winrm'" + ansible_winrm_transport: "'kerberos'" + ansible_winrm_server_cert_validation: "'ignore'" + ansible_port: "5986" + ansible_winrm_kinit_env_vars: "['KRB5_CONFIG']" +keyed_groups: + - key: microsoft_ad_distinguished_name | microsoft.ad.parse_dn | selectattr('0', 'eq', 'OU') | map(attribute='1') | first | lower | default('default') + prefix: ou + separator: "_" diff --git a/windows/setup.yml b/windows/setup.yml index f3239a97c..3b00cbbe4 100644 --- a/windows/setup.yml +++ b/windows/setup.yml @@ -55,6 +55,34 @@ controller_credential_types: ansible_user: !unsafe '{{ username }}' ansible_password: !unsafe '{{ password }}' + - name: Microsoft AD LDAP + description: >- + Credential for the microsoft.ad.ldap inventory plugin. Injects the + connection env vars documented at + https://docs.ansible.com/projects/ansible/latest/collections/microsoft/ad/ldap_inventory.html + kind: cloud + inputs: + fields: + - id: username + type: string + label: Username + - id: password + type: string + label: Password + secret: true + - id: server + type: string + label: Domain Controller (LDAP Server) + required: + - username + - password + - server + injectors: + env: + MICROSOFT_AD_LDAP_USERNAME: !unsafe '{{ username }}' + MICROSOFT_AD_LDAP_PASSWORD: !unsafe '{{ password }}' + MICROSOFT_AD_LDAP_SERVER: !unsafe '{{ server }}' + controller_credentials: - name: Kerberos Credential credential_type: Kerberos @@ -67,6 +95,35 @@ controller_credentials: default_realm: ANSIBLE.LOCAL kdc: REPLACEME + - name: Microsoft AD LDAP Credential + credential_type: Microsoft AD LDAP + organization: Ansible Product Demos (APD) + update_secrets: false + state: exists + inputs: + username: ec2-user@ANSIBLE.LOCAL + password: REPLACEME + server: REPLACEME + +controller_inventories: + - name: Windows AD Inventory + organization: Ansible Product Demos (APD) + description: Hosts discovered from Active Directory via microsoft.ad.ldap + +# Disable AD inventory sync during setup; dependent on Setup Active Directory Domain workflow +aap_configuration_dispatcher_exclude_roles: [controller_inventory_source_update] + +controller_inventory_sources: + - name: AD LDAP Inventory + inventory: Windows AD Inventory + source: scm + source_project: Ansible Product Demos + source_path: windows/inventory.microsoft.ad.ldap.yml + credential: Microsoft AD LDAP Credential + overwrite: true + update_on_launch: false + update_on_project_update: false + controller_templates: - name: "WINDOWS | Install IIS" labels: @@ -276,7 +333,8 @@ controller_templates: project: "Ansible Product Demos" playbook: "windows/powershell.yml" limit: domain_ansible_local - ask_limit_on_launch: false + ask_inventory_on_launch: true + ask_limit_on_launch: true notification_templates_started: Telemetry notification_templates_success: Telemetry notification_templates_error: Telemetry @@ -497,7 +555,11 @@ controller_workflows: - question_name: Keypair Public Key type: textarea variable: aws_public_key - required: true + 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 @@ -594,12 +656,15 @@ controller_workflows: failure_nodes: - Cleanup Resources success_nodes: - - Domain Inventory Sync - - identifier: Domain Inventory Sync + - AWS Inventory Sync + - AD LDAP Inventory Sync + - identifier: AWS Inventory Sync unified_job_template: AWS Inventory - all_parents_must_converge: true success_nodes: - PowerShell Validation + - identifier: AD LDAP Inventory Sync + unified_job_template: AD LDAP Inventory + success_nodes: - Kerberos Validation - identifier: Cleanup Resources unified_job_template: WINDOWS | Rollback @@ -615,6 +680,8 @@ controller_workflows: ps_script: "Get-ADComputer -Filter * | Select-Object -Property 'Name'" - identifier: Kerberos Validation unified_job_template: WINDOWS | Run PowerShell | Kerberos + inventory: Windows AD Inventory + limit: all job_type: run extra_data: ps_script: "Get-WinEvent -LogName Security | Where-Object {$_.Message -like '*Kerberos*'} | Select-Object TimeCreated, Message -First 1"