Skip to content

Commit

Permalink
More Azure ansible fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
clong committed Mar 14, 2021
1 parent 4a8781f commit 55d8fb7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
25 changes: 12 additions & 13 deletions Azure/Ansible/roles/exchange/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
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"
win_dns_client:
adapter_names: '*'
ipv4_addresses:
- 192.168.38.102
- 8.8.8.8
log_path: C:\dns_log.txt

- name: Install git
win_chocolatey:
Expand Down Expand Up @@ -72,22 +74,21 @@

- name: Prepare Schema
win_package:
path: E:\Setup.exe
path: F:\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_user: WINDOMAIN\vagrant
ansible_become_password: vagrant
register: prepare_schema
changed_when: "prepare_schema.rc == 0"

- name: Prepare AD
win_package:
path: E:\Setup.exe
path: F:\Setup.exe
arguments: >-
/IAcceptExchangeServerLicenseTerms
/PrepareAD
Expand All @@ -96,14 +97,13 @@
vars:
ansible_become: yes
ansible_become_method: runas
ansible_become_user: WINDOMAIN.local\Administrator
ansible_become_user: WINDOMAIN\vagrant
ansible_become_password: vagrant
register: prepare_ad
changed_when: "prepare_ad.rc == 0"

- name: Install Exchange
win_package:
path: E:\Setup.exe
path: F:\Setup.exe
arguments: >-
/IAcceptExchangeServerLicenseTerms
/Mode:Install
Expand All @@ -112,10 +112,9 @@
vars:
ansible_become: yes
ansible_become_method: runas
ansible_become_user: WINDOMAIN.local\Administrator
ansible_become_user: WINDOMAIN\vagrant
ansible_become_password: vagrant
register: install_exchange
changed_when: "install_exchange.rc == 0"

- name: Reboot after Exchange Installation
win_reboot:
Expand Down
3 changes: 0 additions & 3 deletions ESXi/ansible/roles/exchange/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
ansible_become_user: WINDOMAIN.local\Administrator
ansible_become_password: vagrant
register: prepare_schema
changed_when: "prepare_schema.rc == 0"

- name: Prepare AD
win_package:
Expand All @@ -99,7 +98,6 @@
ansible_become_user: WINDOMAIN.local\Administrator
ansible_become_password: vagrant
register: prepare_ad
changed_when: "prepare_ad.rc == 0"

- name: Install Exchange
win_package:
Expand All @@ -115,7 +113,6 @@
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:
Expand Down

0 comments on commit 55d8fb7

Please sign in to comment.