-
Notifications
You must be signed in to change notification settings - Fork 0
/
ADdeployPS.yaml
48 lines (42 loc) · 1.75 KB
/
ADdeployPS.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Тестовый playbook для развёртывания домена на windows server
- name: Install AD
hosts: control
tags: Run_powershell
tasks:
- name: Check_connect
ansible.windows.win_ping:
tags: ping
- name: Rename Server
ansible.windows.win_powershell:
script: |
Rename-Computer -NewName {{ comp_name_set }} -Restart -Force
tags: rename
- name: Enable and install windows-domain modules
ansible.windows.win_powershell:
script: |
Import-Module ServerManager
Add-WindowsFeature -Name AD-Domain-Services -IncludeAllSubFeature -IncludeManagementTools
Import-Module ADDSDeployment
tags: enable_modules
- name: AD deploy
ansible.windows.win_powershell:
script: >
Install-ADDSForest -CreateDnsDelegation:$false
-DatabasePath "C:\Windows\NTDS"
-DomainMode {{ domain_mode_set }}
-DomainName {{ domain_name_set }}
-DomainNetbiosName {{ netBiosName_set }}
-ForestMode {{ forest_mode_set }}
-InstallDns:$true
-LogPath "C:\Windows\NTDS"
-NoRebootOnCompletion:$false
-SysvolPath "C:\Windows\SYSVOL"
-Force:$true
-SafeModeAdministratorPassword ( convertto-securestring {{ admin_password_set }} -asplaintext -force )
tags: deploy_ad
- name: Set static ip and dns
ansible.windows.win_powershell:
script: |
netsh interface ipv4 set address name=Ethernet source=static address={{ domain_ip }} gateway={{ gateAway }} store=persistent
Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses ("127.0.0.1")
tags: set_ip