20 lines
930 B
YAML
20 lines
930 B
YAML
---
|
|
- name: Create directory structure
|
|
ansible.windows.win_file:
|
|
path: \\awe-mps-006.adagility.net\cor$\{{ansible_date_time.year + ansible_date_time.month + ansible_date_time.day}}\Infra\Configs\DHCP\
|
|
state: directory
|
|
- name: Run PowerShell script for dhcp config
|
|
ansible.windows.win_powershell:
|
|
script: |
|
|
Export-DhcpServer -computerName {{item}} -File "\\awe-mps-006.adagility.net\cor$\$(get-date -f yyyyMMdd)\Infra\Configs\DHCP\{{item}}.xml"
|
|
loop: "{{servers}}"
|
|
register: pwsh_output
|
|
- name: check if file exists
|
|
ansible.windows.win_file:
|
|
path: \\awe-mps-006.adagility.net\cor$\{{ansible_date_time.year + ansible_date_time.month + ansible_date_time.day}}\Infra\Configs\DHCP\{{item}}.xml
|
|
loop: "{{servers}}"
|
|
|
|
|
|
|
|
|
|
# Export-DhcpServer -computerName gns-mgt-001 -File "\\awe-mps-006.adagility.net\cor$\Infra\Configs\DHCP\gns-mgt-001-$(get-date -f yyyy-MM-dd).xml" |