diff --git a/ansible/roles/win_domain_controller/tasks/setup.yml b/ansible/roles/win_domain_controller/tasks/setup.yml index 829d206..307af51 100644 --- a/ansible/roles/win_domain_controller/tasks/setup.yml +++ b/ansible/roles/win_domain_controller/tasks/setup.yml @@ -24,7 +24,7 @@ - name: Copy ADMX and ADML files to DCs win_copy: src: policy_templates/PolicyDefinitions - dest: "C:\\Windows\\SYSVOL\\sysvol\\{{ win_project }}.loc\\policies\\" + dest: "{{ policy_path }}\\" force: true - name: Rebooting DC01 post promotion to domain controller @@ -162,7 +162,7 @@ vars: proxy_vm: "{{ os_project }}-{{ win_project }}-proxy" proxy_address: "{{ hostvars[proxy_vm].ansible_host }}:3128" - ansible.builtin.template: + ansible.windows.win_template: src: "{{ squid_proxy_script_tmpl }}" dest: "{{ script_dir }}\\{{ squid_proxy_script }}" force: true @@ -174,3 +174,18 @@ when: | inventory_hostname in groups['meta-name_dc01'] and project_zone == 'protected' + +- name: Mapped Drive GPO Script + tags: mapped_drive_script + block: + - name: Copy Mapped Drive GPO Script + ansible.windows.win_template: + src: "{{ mapped_drive_script_tmpl }}" + dest: "{{ script_dir }}\\{{ mapped_drive_script }}" + force: true + tags: copy_mapped_drive_script + + - name: Apply Mapped Drive GPO Script + win_shell: "powershell {{ script_dir }}\\{{ mapped_drive_script }}" + tags: create_mapped_drive_gpo + when: inventory_hostname in groups['meta-name_dc01'] \ No newline at end of file diff --git a/ansible/roles/win_domain_controller/templates/mapped_drive.ps1.j2 b/ansible/roles/win_domain_controller/templates/mapped_drive.ps1.j2 new file mode 100644 index 0000000..79443b1 --- /dev/null +++ b/ansible/roles/win_domain_controller/templates/mapped_drive.ps1.j2 @@ -0,0 +1,30 @@ +$gp_name = "Map Study Drive" + +New-GPO -Name $gp_name + +$gp = Get-GPO -Name $gp_name +$gp_id = $gp.Id + +$create_date = Get-Date -Format "yyyy-MM-dd HH:mm:ss" + +$xml_path = "{{ policy_path }}\{$gp_id}\User\Preferences\Drives" +New-Item -ItemType Directory -Force $xml_path + +$data = @" + + + + + + +"@ + +$data | Out-File $xml_path\Drives.xml -Encoding utf8 -Force + +$DomainInfo = Get-ADDomain +$DomainOU = $DomainInfo.DistinguishedName +$workbenchOU = (Get-ADOrganizationalUnit -Identity "OU=Workbench,$DomainOU").DistinguishedName + +New-GPLink -Name $gp_name -Target $workbenchOU + +Write-Output "THIS SCRIPT ACTUALLY RAN" | Out-File -FilePath 'C:\eidf\StudyDrive_script.txt' diff --git a/ansible/roles/win_domain_controller/vars/main.yml b/ansible/roles/win_domain_controller/vars/main.yml index 30ad142..71d11ec 100644 --- a/ansible/roles/win_domain_controller/vars/main.yml +++ b/ansible/roles/win_domain_controller/vars/main.yml @@ -1,9 +1,17 @@ +policy_path: "C:\\Windows\\SYSVOL\\sysvol\\{{ win_project }}.loc\\Policies" + group_policy_script: OpenStackADBuild.ps1 server_hardening_script: serverhardening.ps1 squid_proxy_script: proxy_gpo.ps1 squid_proxy_script_tmpl: proxy_gpo.ps1.j2 script_dir: C:\eidf +mapped_drive_script: mapped_drive.ps1 +mapped_drive_script_tmpl: mapped_drive.ps1.j2 +study_data_dfs: \\{{ win_project }}\Study_Data +study_data_label: Study Data +study_data_letter: S + OUs: - Project Users - Project Groups