Skip to content

Instantly share code, notes, and snippets.

View get_esxi_cpuoc.ps1
Get-VMHost | Sort-Object Name | % {
$hv = $_
$hv_pcpu_count = $hv.NumCpu
$power_on_vms = $hv | Get-VM | where {$_.PowerState -eq "PoweredOn"}
$hv_vcpu_count = ($power_on_vms| Measure-Object -Sum NumCpu).Sum + 0
$hv_oc_percent = $hv_vcpu_count / $hv_pcpu_count * 100
"-----"
$hv.Parent.Name + "/" + $hv.Name + " ConnectionState:" + $hv.ConnectionState
"$hv_pcpu_count pCPU で、$hv_vcpu_count vCPU が起動中です。"
View create_share.yml
---
- name: Create Nutanix Files SMB Share
hosts: localhost
connection: local
gather_facts: no
vars_files:
- ./login.yml
vars:
fs_name: "test-fs-01"
View delete_file-server.yml
---
- name: Delete Nutanix Files File Server
hosts: localhost
connection: local
gather_facts: no
vars_files:
- ./login.yml
- ./login-ad.yml
vars:
fs_name: "test-fs-01"
View create_file-server.yml
---
- name: Create Nutanix Files File Server
hosts: localhost
connection: local
gather_facts: no
vars_files:
- ./login.yml
- ./login-ad.yml
vars:
View test-fs-01.json
{
"name": "test-fs-01",
"sizeGib": 1024,
"dnsDomainName": "ntnx.lab",
"numCalculatedNvms": 1,
"numVcpus": 4,
"memoryGiB": 12,
"externalNetworks": [
{
"name": "nw-vlan-31",
View create_file-server_test-fs-01.sh
ncli file-server create \
name=test-fs-01 \
dns-domain-name=ntnx.lab \
size-gib=1000 \
nvm-count=1 \
external-virtual-network=f513d008-8d20-4826-893e-5363918a6f46 \
external-virtual-network-mask=255.255.255.0 \
external-virtual-network-gateway=192.168.31.1 \
external-virtual-network-ips=192.168.31.11 \
dns-server-ip-address-list=192.168.10.170 \
View avi_segroup_Default-Group.json
{
"active_standby": true,
"aggressive_failure_detection": false,
"algo": "PLACEMENT_ALGO_DISTRIBUTED",
"app_cache_percent": 0,
"app_cache_threshold": 5,
"app_learning_memory_percent": 0,
"archive_shm_limit": 8,
"async_ssl": false,
"async_ssl_threads": 1,
View avi_segroup_Default-Group.yml
---
- name: Create / Output Avi SE Group
hosts: localhost
connection: local
gather_facts: false
vars_files:
- ./login.yml
vars:
avi_cloud_name: Default-Cloud
View get_avi-version.yml
---
- name: Get Avi API Version
hosts: localhost
connection: local
gather_facts: false
vars_files:
- ./login.yml
tasks:
- name: Get Avi API Version
View get_nutanix_cluster_info.yml
---
- name: Ansible x Nutnaix Test
hosts: localhost
connection: local
gather_facts: no
vars:
prism_address: "Prism IP Address or FQDN"
prism_username: "admin"
prism_password: "nutanix/4u"