forked from clong/DetectionLab
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request clong#622 from clong/exchange_esxi_azure
Adding Exchange for Azure and ESXi
- Loading branch information
Showing
17 changed files
with
466 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,9 @@ | |
- win10 | ||
- common | ||
tags: win10 | ||
|
||
- hosts: exchange | ||
roles: | ||
- exchange | ||
- common | ||
tags: exchange |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,7 @@ win10: | |
hosts: | ||
z.z.z.z: | ||
|
||
#exchange: | ||
#hosts: | ||
#w.w.w.w: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
--- | ||
|
||
- name: Hostname -> EXCHANGE | ||
win_hostname: | ||
name: EXCHANGE | ||
register: res | ||
|
||
- name: Reboot | ||
win_reboot: | ||
when: res.reboot_required | ||
|
||
- name: Set HostOnly IP Address | ||
win_shell: "If (-not(get-netipaddress | where {$_.IPAddress -eq '192.168.38.106'})) {$adapter = (get-netadapter | where {$_.MacAddress -eq '00-50-56-A1-B4-C5'}).Name; New-NetIPAddress –InterfaceAlias $adapter –AddressFamily IPv4 -IPAddress 192.168.38.106 –PrefixLength 24 -DefaultGateway 192.168.38.1 } Else { Write-Host 'IP Address Already Created.' }" | ||
|
||
- name: Set HostOnly DNS Address | ||
win_shell: "$adapter = (get-netadapter | where {$_.MacAddress -eq '00-50-56-A1-B4-C5'}).Name; Set-DnsClientServerAddress -InterfaceAlias $adapter -ServerAddresses 192.168.38.102,8.8.8.8" | ||
|
||
- name: Install git | ||
win_chocolatey: | ||
name: git | ||
state: present | ||
|
||
- name: Check if existing DetectionLab directory | ||
win_stat: | ||
path: 'c:\DetectionLab' | ||
register: dir | ||
|
||
- name: Git clone Detectionlab | ||
win_shell: git clone https://github.com/clong/DetectionLab.git | ||
args: | ||
chdir: 'c:\' | ||
when: not dir.stat.exists | ||
|
||
- name: Copy scripts to c:\vagrant | ||
win_shell: Copy-Item -Recurse c:\DetectionLab\Vagrant c:\vagrant | ||
|
||
- name: Join the Domain | ||
win_shell: .\\provision.ps1 | ||
args: | ||
chdir: 'c:\vagrant\scripts' | ||
register: exchange_join_domain | ||
changed_when: "'HasSucceeded : True' in exchange_join_domain.stdout" | ||
|
||
- debug: msg="{{ exchange_join_domain.stdout_lines }}" | ||
|
||
- name: Reboot After Joining the Domain | ||
win_reboot: | ||
msg: "Joining the domain. Rebooting..." | ||
pre_reboot_delay: 5 | ||
reboot_timeout: 600 | ||
post_reboot_delay: 60 | ||
|
||
- name: Install Exchange Prereqs | ||
win_shell: .\\install-exchange.ps1 | ||
args: | ||
chdir: 'c:\vagrant\scripts' | ||
register: exchange_prereqs | ||
changed_when: "'A reboot is required to continue installation of exchange.' in exchange_prereqs.stdout" | ||
|
||
- name: Reboot After Installing Exchange PreReqs | ||
win_reboot: | ||
msg: "Exchange Prereqs installed. Rebooting..." | ||
pre_reboot_delay: 5 | ||
reboot_timeout: 600 | ||
post_reboot_delay: 60 | ||
|
||
- name: Download Exchange ISO and Mount It | ||
win_shell: .\\install-exchange.ps1 | ||
args: | ||
chdir: 'c:\vagrant\scripts' | ||
register: download_exchange_iso | ||
|
||
- name: Prepare Schema | ||
win_package: | ||
path: E:\Setup.exe | ||
arguments: >- | ||
/IAcceptExchangeServerLicenseTerms | ||
/PrepareSchema | ||
product_id: '{CD981244-E9B8-405A-9026-6AEB9DCEF1F1}' | ||
vars: | ||
ansible_become: yes | ||
ansible_become_method: runas | ||
ansible_become_user: WINDOMAIN.local\Administrator | ||
ansible_become_password: vagrant | ||
register: prepare_schema | ||
changed_when: "prepare_schema.rc == 0" | ||
|
||
- name: Prepare AD | ||
win_package: | ||
path: E:\Setup.exe | ||
arguments: >- | ||
/IAcceptExchangeServerLicenseTerms | ||
/PrepareAD | ||
/OrganizationName: DetectionLab | ||
product_id: '{CD981244-E9B8-405A-9026-6AEB9DCEF1F1}' | ||
vars: | ||
ansible_become: yes | ||
ansible_become_method: runas | ||
ansible_become_user: WINDOMAIN.local\Administrator | ||
ansible_become_password: vagrant | ||
register: prepare_ad | ||
changed_when: "prepare_ad.rc == 0" | ||
|
||
- name: Install Exchange | ||
win_package: | ||
path: E:\Setup.exe | ||
arguments: >- | ||
/IAcceptExchangeServerLicenseTerms | ||
/Mode:Install | ||
/Role:Mailbox | ||
product_id: '{CD981244-E9B8-405A-9026-6AEB9DCEF1F1}' | ||
vars: | ||
ansible_become: yes | ||
ansible_become_method: runas | ||
ansible_become_user: WINDOMAIN.local\Administrator | ||
ansible_become_password: vagrant | ||
register: install_exchange | ||
changed_when: "install_exchange.rc == 0" | ||
|
||
- name: Reboot after Exchange Installation | ||
win_reboot: | ||
msg: "Exchange installed. Rebooting..." | ||
pre_reboot_delay: 5 | ||
reboot_timeout: 600 | ||
post_reboot_delay: 60 | ||
|
||
- name: Clear Event Logs | ||
win_shell: "wevtutil el | Select-String -notmatch \"Microsoft-Windows-LiveId\" | Foreach-Object {wevtutil cl \"$_\"}" | ||
|
||
- name: Configure EXCHANGE with raw Commands | ||
win_shell: "{{ item }}" | ||
with_items: | ||
- "wevtutil el | Select-String -notmatch \"Microsoft-Windows-LiveId\" | Foreach-Object {wevtutil cl \"$_\"}" | ||
- "Set-SmbServerConfiguration -AuditSmb1Access $true -Force" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,9 @@ | |
- win10 | ||
- common | ||
tags: win10 | ||
|
||
- hosts: exchange | ||
roles: | ||
- exchange | ||
- common | ||
tags: exchange |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,6 @@ win10: | |
hosts: | ||
192.168.3.204: | ||
|
||
exchange: | ||
hosts: | ||
192.168.3.206: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.