Move Exchange to AddOns Folder
This commit is contained in:
@@ -22,8 +22,4 @@
|
||||
- common
|
||||
tags: win10
|
||||
|
||||
- hosts: exchange
|
||||
roles:
|
||||
- exchange
|
||||
- common
|
||||
tags: exchange
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
logger:
|
||||
hosts:
|
||||
192.168.3.205:
|
||||
w.w.w.w:
|
||||
ansible_user: vagrant
|
||||
ansible_password: vagrant
|
||||
ansible_port: 22
|
||||
@@ -21,6 +21,4 @@ win10:
|
||||
hosts:
|
||||
z.z.z.z:
|
||||
|
||||
#exchange:
|
||||
# hosts:
|
||||
# w.w.w.w:
|
||||
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
---
|
||||
|
||||
- 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
|
||||
|
||||
- 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
|
||||
|
||||
- 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
|
||||
|
||||
- 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 \"$_\"}"
|
||||
|
||||
30
ESXi/main.tf
30
ESXi/main.tf
@@ -121,36 +121,6 @@ resource "esxi_guest" "wef" {
|
||||
guest_shutdown_timeout = 30
|
||||
}
|
||||
|
||||
resource "esxi_guest" "exchange" {
|
||||
# See https://blog.gruntwork.io/terraform-tips-tricks-loops-if-statements-and-gotchas-f739bbae55f9#0223 for explanation about count
|
||||
count = var.create_exchange_server ? 1 : 0
|
||||
guest_name = "exchange"
|
||||
disk_store = var.esxi_datastore
|
||||
guestos = "windows9srv-64"
|
||||
|
||||
boot_disk_type = "thin"
|
||||
|
||||
memsize = "8192"
|
||||
numvcpus = "4"
|
||||
resource_pool_name = "/"
|
||||
power = "on"
|
||||
clone_from_vm = "WindowsServer2016"
|
||||
# This is the network that bridges your host machine with the ESXi VM
|
||||
network_interfaces {
|
||||
virtual_network = var.vm_network
|
||||
mac_address = "00:50:56:a1:b2:c5"
|
||||
nic_type = "e1000"
|
||||
}
|
||||
# This is the local network that will be used for 192.168.38.x addressing
|
||||
network_interfaces {
|
||||
virtual_network = var.hostonly_network
|
||||
mac_address = "00:50:56:a1:b4:c5"
|
||||
nic_type = "e1000"
|
||||
}
|
||||
guest_startup_timeout = 45
|
||||
guest_shutdown_timeout = 30
|
||||
}
|
||||
|
||||
resource "esxi_guest" "win10" {
|
||||
guest_name = "win10"
|
||||
disk_store = var.esxi_datastore
|
||||
|
||||
@@ -22,14 +22,6 @@ output "wef_ips" {
|
||||
value = esxi_guest.wef.ip_address
|
||||
}
|
||||
|
||||
output "exchange_interfaces" {
|
||||
value = esxi_guest.exchange[0].network_interfaces
|
||||
}
|
||||
|
||||
output "exchange_ips" {
|
||||
value = "${var.create_exchange_server ? esxi_guest.exchange[0].ip_address : null}"
|
||||
}
|
||||
|
||||
output "win10_interfaces" {
|
||||
value = esxi_guest.win10.network_interfaces
|
||||
}
|
||||
|
||||
@@ -30,9 +30,3 @@ variable "vm_network" {
|
||||
variable "hostonly_network" {
|
||||
default = "HostOnly Network"
|
||||
}
|
||||
|
||||
variable "create_exchange_server" {
|
||||
description = "If set to true, adds an additional host that installs exchange"
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user