This is how I created the mountpoint after add the virtual disk on 2016 and
above servers
- name: Online | Initialize | Format SQL Disk - Mountpoint
win_shell: |
$Disk = @(Get-Disk | where-object{$_.OperationalStatus -eq 'Offline' -or
$_.PartitionStyle -eq 'RAW'} | sort Number )
if($Disk.count -eq 1 ){
try{
$Disk | Initialize-Disk -PartitionStyle GPT -ErrorAction
SilentlyContinue
$Disk | New-Partition -UseMaximumSize -DriveLetter "E"
$Partition = Get-Disk -Number $Disk[0].Number | Get-Partition |
where{$_.type -eq 'Basic'}
$Partition | Format-Volume -FileSystem NTFS -Confirm:$false
-AllocationUnitSize 65536 -NewFileSystemLabel "MOUNTPOINT (1:0)"
}
catch{
$_.exception
}
}
and this is how i added the mountpoints to it
---
- name: Online | Initialize | Format SQL Disk - {{ drive_label }}
win_shell: |
$Disk = @(Get-Disk | where-object{$_.OperationalStatus -eq 'Offline' -or
$_.PartitionStyle -eq 'RAW'} | sort Number )
if($Disk.count -eq 1 ){
try{
$Disk | Initialize-Disk -PartitionStyle GPT -ErrorAction
SilentlyContinue
$Disk | New-Partition -UseMaximumSize
$Partition = Get-Disk -Number $Disk[0].Number | Get-Partition |
where{$_.type -eq 'Basic'}
$Partition | Format-Volume -FileSystem NTFS -Confirm:$false
-AllocationUnitSize 65536 -NewFileSystemLabel "DATA (2:0)"
New-Item -ItemType Directory -Path "E:\DATA"
$Partition | Add-PartitionAccessPath -AccessPath "E:\DATA"
}
catch{
$_.exception
}
}
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/c75e4285-a3ab-4915-8834-a6eb88fe6786n%40googlegroups.com.