mirror of
https://github.com/Oxalide/vsphere-influxdb-go.git
synced 2023-10-10 11:36:51 +00:00
add vendoring with go dep
This commit is contained in:
44
vendor/github.com/vmware/govmomi/govc/examples/lib/ssh.sh
generated
vendored
Normal file
44
vendor/github.com/vmware/govmomi/govc/examples/lib/ssh.sh
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
function public-key {
|
||||
local dir=${HOME}/.ssh
|
||||
|
||||
for f in $HOME/.ssh/{id_{rsa,dsa},*}.pub; do
|
||||
if [ -r $f ]; then
|
||||
echo $f
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Can't find public key file..."
|
||||
exit 1
|
||||
}
|
||||
|
||||
PUBLIC_KEY_FILE=${PUBLIC_KEY_FILE-$(public-key)}
|
||||
SSH_OPTS="-oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oLogLevel=quiet"
|
||||
|
||||
function upload-public-key {
|
||||
local vm_name=$1
|
||||
local dir=$2
|
||||
|
||||
if [ -z "$dir" ]
|
||||
then
|
||||
uid=$(echo $GOVC_GUEST_LOGIN | awk -F: '{print $1}')
|
||||
dir=$(govc guest.getenv -vm ${vm_name} HOME | awk -F= '{print $2}')
|
||||
|
||||
if [ -z "$dir" ]
|
||||
then
|
||||
echo "Can't find ${uid}'s HOME dir..."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
govc guest.mkdir \
|
||||
-vm ${vm_name} \
|
||||
-p \
|
||||
${dir}/.ssh
|
||||
|
||||
govc guest.upload \
|
||||
-vm ${vm_name} \
|
||||
-f \
|
||||
${PUBLIC_KEY_FILE} \
|
||||
${dir}/.ssh/authorized_keys
|
||||
}
|
57
vendor/github.com/vmware/govmomi/govc/examples/vcsa.sh
generated
vendored
Executable file
57
vendor/github.com/vmware/govmomi/govc/examples/vcsa.sh
generated
vendored
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
lib=$(readlink -nf $(dirname $0))/lib
|
||||
. $lib/ssh.sh
|
||||
|
||||
ova=$1
|
||||
|
||||
if [ -z "$ova" ]
|
||||
then
|
||||
ova=./VMware-vCenter-Server-Appliance-5.5.0.10300-2000350_OVF10.ova
|
||||
fi
|
||||
|
||||
# default to local Vagrant esxbox for testing
|
||||
export GOVC_URL=${GOVC_URL-"https://root:vagrant@localhost:8443/sdk"}
|
||||
|
||||
# default VCSA credentials
|
||||
export GOVC_GUEST_LOGIN=root:vmware
|
||||
|
||||
# VM name as defined in the VCSA .ovf
|
||||
vm_name=VMware_vCenter_Server_Appliance
|
||||
|
||||
echo "Importing $ova..."
|
||||
govc import.ova $ova
|
||||
|
||||
echo "Powering on $vm_name..."
|
||||
govc vm.power -on $vm_name
|
||||
|
||||
echo "Waiting for $vm_name's IP address..."
|
||||
vc=$(govc vm.ip $vm_name)
|
||||
|
||||
govc vm.info $vm_name
|
||||
|
||||
echo "Uploading ssh public key to $vm_name..."
|
||||
upload-public-key $vm_name
|
||||
|
||||
echo "Configuring vCenter Server Appliance..."
|
||||
|
||||
# http://www.virtuallyghetto.com/2012/02/automating-vcenter-server-appliance.html
|
||||
ssh ${SSH_OPTS} root@$vc <<EOF
|
||||
echo "Accepting EULA ..."
|
||||
/usr/sbin/vpxd_servicecfg eula accept
|
||||
|
||||
echo "Configuring Embedded DB ..."
|
||||
/usr/sbin/vpxd_servicecfg db write embedded
|
||||
|
||||
echo "Configuring SSO..."
|
||||
/usr/sbin/vpxd_servicecfg sso write embedded
|
||||
|
||||
echo "Starting VCSA ..."
|
||||
/usr/sbin/vpxd_servicecfg service start
|
||||
EOF
|
||||
|
||||
vc_url=https://${GOVC_GUEST_LOGIN}@${vc}/sdk
|
||||
|
||||
echo "VCSA configured and ready..."
|
||||
|
||||
govc about -u $vc_url
|
Reference in New Issue
Block a user