Skip to content

Instantly share code, notes, and snippets.

View gist:bda4820e33532319423e6669c73af905
FROM mirror.gcr.io/library/ubuntu:bionic
ENV TERM linux
WORKDIR /root
ARG POWERCLI_VERSION="12.4.0.18633274"
RUN echo "/usr/bin/pwsh" >> /etc/shells && \
echo "/bin/pwsh" >> /etc/shells && \
apt update && \
@lamw
lamw / gist:f3a3b7134c03b2d945d741a250c3f05f
Created Mar 1, 2022
PowerCLI snippet to map PVC to vSphere Datastore
View gist:f3a3b7134c03b2d945d741a250c3f05f
$volumes = Get-CnsVolume
$results = @()
foreach ($volume in $volumes) {
$entityDetails = $volume.ExtensionData.Metadata.EntityMetadata | where {$_.EntityType -eq "PERSISTENT_VOLUME_CLAIM"}
if($entityDetails) {
$tmp = [pscustomobject] @{
VolumeName = $volume.name;
PVCName = $entityDetails.EntityName;
Namespace = $entityDetails.Namespace;
Datastore = $volume.datastore.name;
@lamw
lamw / gist:f66f1ca6c059b2852f03adb0d627abf2
Created Oct 26, 2021
vSphere w/Tanzu ClusterRole Edit
View gist:f66f1ca6c059b2852f03adb0d627abf2
root@42294959c845d4be8507807dd2d100d0 [ ~ ]# k get clusterrole edit -o yaml
aggregationRule:
clusterRoleSelectors:
- matchLabels:
rbac.authorization.k8s.io/aggregate-to-edit: "true"
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations:
@lamw
lamw / gist:086320a7545c47b802a4db3127d91b27
Created Oct 26, 2021
vSphere w/Tanzu ClusterRole View
View gist:086320a7545c47b802a4db3127d91b27
root@42294959c845d4be8507807dd2d100d0 [ ~ ]# k get clusterrole view -o yaml
aggregationRule:
clusterRoleSelectors:
- matchLabels:
rbac.authorization.k8s.io/aggregate-to-view: "true"
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations:
@lamw
lamw / configstore_esxi70u2.json
Created Jul 19, 2021
Schema for ConfigStore in ESXi 7.0 Update 2
View configstore_esxi70u2.json
{
"clusterstore": {
"cluster_agent": [
"agent_settings"
]
},
"esx": {
"assignhw": [
"overrides"
],
@lamw
lamw / gist:4e3206fc8e13c3280a0074c9f50498d3
Created Apr 23, 2021
ingressroute-gateway-modified.yaml
View gist:4e3206fc8e13c3280a0074c9f50498d3
---
apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
annotations:
kubernetes.io/ingress.class: contour-external
labels:
app: vmware
name: event-router
namespace: vmware-system
@lamw
lamw / gist:cd9881727237148e8d5bb8f8435b4c2e
Created Feb 1, 2021
Fix vSphere UI downloading plugin-in: com.vmware.h4.vsphere.client
View gist:cd9881727237148e8d5bb8f8435b4c2e
SERVICE_IDS=$(/usr/lib/vmware-lookupsvc/tools/lstool.py list --ep-type com.vmware.cis.vsphereclient.plugin --url http://localhost:7090/lookupservice/sdk --type vsphere.client --id-only | grep -v JAVA)
VC_USERNAME='administrator@vsphere.local'
VC_PASSWORD='VMware1!'
for SERVICE_ID in ${SERVICE_IDS[@]};
do
/usr/lib/vmware-lookupsvc/tools/lstool.py unregister --url http://localhost:7090/lookupservice/sdk --user ${VC_USERNAME} --password "${VC_PASSWORD}" --id ${SERVICE_ID} --no-check-cert
done
vmon-cli -r vsphere-ui
@lamw
lamw / gist:7069bc74e020485d0de8c43a0ff8f67f
Created Nov 19, 2020
Automated installation of VMware Harbor Registry on Photon OS
View gist:7069bc74e020485d0de8c43a0ff8f67f
DOCKER_COMPOSE_VERSION=1.27.4
HARBOR_VERSION=1.10.6
DEFAULT_HARBOR_PASSWORD='Tanzu1!'
HARBOR_HOSTNAME=registry.tanzu.local
systemctl enable docker
systemctl start docker
curl -L "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
@lamw
lamw / gist:a9ab09834a806505fd02415ed2b85131
Created Jun 23, 2020
VMC Terraform Provider for deploying 1 & 2 Node SDDC
View gist:a9ab09834a806505fd02415ed2b85131
# 1-Node SDDC
provider "vmc" {
refresh_token = var.refresh_token
org_id = var.org_id
}
resource "vmc_sddc" "sddc_1" {
sddc_name = "1-Node-SDDC"
num_host = 1
@lamw
lamw / gist:27818554a29a1f4db164d432a691bf77
Last active Jun 23, 2020
VMC REST API for deploying 1 & 2 Node SDDC
View gist:27818554a29a1f4db164d432a691bf77
# 1-Node SDDC
POST /orgs/{orgs}/sddcs
{
"name": "1-Node-SDDC",
"num_hosts": 1,
"deployment_type": "SingleAZ",
"sddc_type": "1NODE",
"provider": "AWS",