Skip to content

Instantly share code, notes, and snippets.

View cloud-init_ansible-epel-rpm.txt
#cloud-config
disable_root: true
ssh_pwauth: true
package_upgrade: false
users:
- name: nutanix
lock-passwd: false
sudo: ALL=(ALL) NOPASSWD:ALL
View add_host_to_vds.ps1
$ESX = "192.168.10.164" # または esxi01.example.com
$VDS = "VDS_A"
$VMNIC1 = "vmnic1"
$VMNIC2 = "vmnic2"
$UPLINK1 = "UpLink_1"
$UPLINK2 = "UpLink_2"
$UPLINK_PG = "UpLinkPG_A"
$PG = "PG_A"
# ①VDS_Aへ新規ホストを追加
View vm_service_demo_lab-centos-vm-01.yml
kind: ConfigMap
apiVersion: v1
metadata:
name: configmap-lab-centos-vm-01
namespace: lab-ns-31
data:
hostname: lab-centos-vm-01
user-data: |
I2Nsb3VkLWNvbmZpZwp1c2VyczoKICAtIG5hbWU6IGRlbW8KICAgIHNoZWxsOiAvYmluL2Jhc2gK
ICAgIHN1ZG86IEFMTD0oQUxMKSBOT1BBU1NXRDpBTEwKY2hwYXNzd2Q6CiAgICBsaXN0OiB8CiAg
View svc-lab-centos-vm-01.yml
kind: VirtualMachineService
apiVersion: vmoperator.vmware.com/v1alpha1
metadata:
name: svc-lab-centos-vm-01
namespace: lab-ns-31
spec:
type: LoadBalancer
ports:
- name: ssh
port: 22
View lab-centos-vm-01.yml
kind: VirtualMachine
apiVersion: vmoperator.vmware.com/v1alpha1
metadata:
name: lab-centos-vm-01
namespace: lab-ns-31
labels:
demo: vm-service-01
spec:
imageName: centos-stream-8-vmservice-v1alpha1-1619529007339
className: best-effort-xsmall
View configmap-lab-centos-vm-01.yml
kind: ConfigMap
apiVersion: v1
metadata:
name: configmap-lab-centos-vm-01
namespace: lab-ns-31
data:
hostname: lab-centos-vm-01
user-data: |
I2Nsb3VkLWNvbmZpZwp1c2VyczoKICAtIG5hbWU6IGRlbW8KICAgIHNoZWxsOiAvYmluL2Jhc2gK
ICAgIHN1ZG86IEFMTD0oQUxMKSBOT1BBU1NXRDpBTEwKY2hwYXNzd2Q6CiAgICBsaXN0OiB8CiAg
View lab-centos-vm-01.userdata
#cloud-config
users:
- name: demo
shell: /bin/bash
sudo: ALL=(ALL) NOPASSWD:ALL
chpasswd:
list: |
demo:VMware1!
expire: false
ssh_pwauth: yes
@gowatana
gowatana / get_vmdk_parent.ps1
Last active May 8, 2021
PowerCLI で、親 VMDK のパスを表示する。
View get_vmdk_parent.ps1
$vm_name = $args[0]
Get-VM $vm_name | %{
$vm = $_
$vm | Get-HardDisk | %{
$vmdk = $_
$vmdk_table = @()
$vmdk_table += $vmdk.ExtensionData.Backing
$parent = $vmdk.ExtensionData.Backing.Parent
@gowatana
gowatana / enable_wcp-cluster-31.ps1
Last active May 1, 2021
PowerCLI で vSphere with Tanzu(+ NSX-T)のスーパーバイザー クラスタを有効化する。
View enable_wcp-cluster-31.ps1
Enable-WMCluster -Cluster "wcp-cluster-31" `
-SizeHint Tiny `
-EphemeralStoragePolicy "vm-storage-policy-wcp" `
-ImageStoragePolicy "vm-storage-policy-wcp" `
-MasterStoragePolicy "vm-storage-policy-wcp" `
-ManagementVirtualNetwork (Get-VirtualNetwork -Name "DPortGroup-0010-MGMT") `
-ManagementNetworkMode StaticRange `
-ManagementNetworkStartIPAddress "192.168.10.51" `
-ManagementNetworkSubnetMask "255.255.255.0" `
-ManagementNetworkGateway "192.168.10.1" `
View gist:419578c034829c15d02cfc9b287c52d7
[vsanDatastore] 8c4b8760-0394-9427-46f1-005056812782/vm02.vmdk
DOM Object: 904b8760-04b9-b605-47fe-005056812782 (v14, owner: 192.168.10.123, proxy owner: None, policy: stripeWidth = 1, cacheReservation = 0, proportionalCapacity = 0, hostFailuresToTolerate = 2, forceProvisioning = 0, spbmProfileId = c9612595-21c4-445a-ad13-f514d02bd160, spbmProfileGenerationNumber = 0, storageType = Allflash, replicaPreference = Capacity, iopsLimit = 0, checksumDisabled = 0, CSN = 14, SCSN = 10, spbmProfileName = RAID6)
RAID_6
Component: 904b8760-cb6b-a806-1e16-005056812782 (state: ACTIVE (5), host: 192.168.10.124, capacity: mpx.vmhba0:C0:T2:L0, cache: mpx.vmhba0:C0:T1:L0,
votes: 2, usage: 0.0 GB, proxy component: false)
Component: 904b8760-ca5a-ab06-f50d-005056812782 (state: ACTIVE (5), host: 192.168.10.123, capacity: mpx.vmhba0:C0:T2:L0, cache: mpx.vmhba0:C0:T1:L0,
votes: 1, usage: 0.0