Creating Volumes in Pure and Vmware ESXi with a rundeck job
log into autoadmin as rundeck
cat ./.ssh/id_rsa.pub
log into the pure unit with ssh rundeck@pure
set the key
pureadmin setattr --publickey
<paste id_rsa.pub's content here>
exit
test connection with ssh rundeck@pure "purearray list"
curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo
yum install -y powershell
pwsh
Install Vmware PowerCLI (inside pwsh)
Set-PSRepository -Name "PSGallery" -InstallationPolicy "Trusted"
Find-Module "VMware.PowerCLI" | Install-Module -Scope "CurrentUser" -AllowClobber
Set-PowerCLIConfiguration -InvalidCertificateAction "Ignore"
Import-Module "VMware.PowerCLI"
Connect-VIServer -Server <vcenter server fqdn>
Get-Vm
Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $false
Creating and connecting a volume
Create the needed options
Add a key value data log filter
Create this Rundeck bash job
ssh @option.PureHost@ "purevol create @option.VolumeName@ --size @option.VolumeSize@"
ssh @option.PureHost@ "purehgroup connect --vol @option.VolumeName@ @option.HostGroupName@"
VolumeSerial=$(ssh @option.PureHost@ "purevol list" | grep @option.VolumeName@ | awk {'print tolower($7)'})
echo "RUNDECK:DATA:VolumeSerial=naa.624a9370$VolumeSerial"
Add a rundeck u/p to the rundeck vault
Create this powershell job
#!/bin/pwsh
Connect-VIServer -Server @option.Vcenter@ -User rundeck -Password @option.rundeck_pw@
Get-VMHostStorage -VMHost @option.Vmhost@ -RescanAllHba -RescanVmfs
Start-Sleep -Second 10
New-Datastore -Name @option.VolumeName@ -VMHost @option.Vmhost@ -Path "@data.VolumeSerial@" -Vmfs -FileSystemVersion 6