From 2734763189815c1fa595b922795250bb7c77fbdd Mon Sep 17 00:00:00 2001 From: Ivaylo Ivanov Date: Tue, 24 Mar 2020 20:10:22 +0100 Subject: [PATCH] Initial commit --- .gitignore | 3 +++ README.md | 14 ++++++++++++++ deploy_esxi.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ example.conf | 22 ++++++++++++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100755 deploy_esxi.sh create mode 100644 example.conf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d3897ea --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +fah.conf +*.ova +*.log \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..f27c7a3 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +Folding@Home ovftool deployment script +-------------------------------------- + +## Introduction +The script is used for deploying the folding@home image supplied by [VMWare](https://flings.vmware.com/vmware-appliance-for-folding-home) on VMWare ESXi (free). + +The script is based on the one from [VMWare's GitHub](https://github.com/lamw/vmware-fah-automation). + +## Usage +1. In order to use it, you need to have `ovftool` installed. + +2. Then, you need to create an `fah.conf` file with the parameters shown in `example.conf` + +3. The script will automatically download the ova if not present in the current directory and will deploy it on the remote ESXi host diff --git a/deploy_esxi.sh b/deploy_esxi.sh new file mode 100755 index 0000000..4868ba8 --- /dev/null +++ b/deploy_esxi.sh @@ -0,0 +1,45 @@ +#!/bin/bash +if [ -x "$(command -v ovftool)" ]; then + # Specify the path for ovftool + OVFTOOL_BIN_PATH=$(which ovftool) + + # Source the configuration + . fah.conf + FAH_OVA="VMware-Appliance-FaH_${FAH_OVA_VERSION}.ova" + + if [ ! -f "${FAH_OVA}" ]; then + # Download OVA if not present + wget "https://download3.vmware.com/software/vmw-tools/VMWare_Folding@Home_Appliance/${FAH_OVA}" + fi + + ### DO NOT EDIT BEYOND HERE ### + + "${OVFTOOL_BIN_PATH}" \ + --X:injectOvfEnv \ + --powerOn \ + --noSSLVerify \ + --sourceType=OVA \ + --allowExtraConfig \ + --diskMode=thin \ + --numberOfCpus:*=${FAH_CPU_COUNT} \ + --name="${FAH_NAME}" \ + --net:"VM Network"="${FAH_NETWORK}" \ + --datastore="${FAH_DATASTORE}" \ + --prop:guestinfo.ipaddress=${FAH_IP} \ + --prop:guestinfo.hostname=${FAH_HOSTNAME} \ + --prop:guestinfo.netmask="${FAH_PREFIX}" \ + --prop:guestinfo.gateway=${FAH_GW} \ + --prop:guestinfo.dns=${FAH_DNS} \ + --prop:guestinfo.domain=${FAH_DNS_DOMAIN} \ + --prop:guestinfo.ntp=${FAH_NTP} \ + --prop:guestinfo.root_password=${FAH_OS_PASSWORD} \ + --prop:guestinfo.fah_username=${FAH_USERNAME} \ + --prop:guestinfo.fah_passkey=${FAH_PASSKEY} \ + --prop:guestinfo.fah_mode=${FAH_MODE} \ + --prop:guestinfo.debug=${FAH_DEBUG} \ + "${FAH_OVA}" \ + "vi://${DEPLOYMENT_TARGET_USERNAME}:${DEPLOYMENT_TARGET_PASSWORD}@${DEPLOYMENT_TARGET_ADDRESS}/" +else + echo 'ERROR: ovftool is not installed.' >&2 + exit 1 +fi diff --git a/example.conf b/example.conf new file mode 100644 index 0000000..aef738f --- /dev/null +++ b/example.conf @@ -0,0 +1,22 @@ +# ESXi settings +DEPLOYMENT_TARGET_ADDRESS="192.168.30.14" +DEPLOYMENT_TARGET_USERNAME="root" +DEPLOYMENT_TARGET_PASSWORD="VMware1!" + +FAH_OVA_VERSION="1.0.1" +FAH_NAME="VMWARE-FAH" +FAH_CPU_COUNT="4" +FAH_IP="192.168.30.112" +FAH_HOSTNAME="fah.primp-industries.com" +FAH_PREFIX="24 (255.255.255.0)" +FAH_GW="192.168.30.1" +FAH_DNS="192.168.30.1" +FAH_DNS_DOMAIN="primp-industries.com" +FAH_NTP="pool.ntp.org" +FAH_OS_PASSWORD="VMware1!" +FAH_NETWORK="VM Network" +FAH_DATASTORE="sm-vsanDatastore" +FAH_DEBUG="True" +FAH_USERNAME="lamw" +FAH_PASSKEY="e6cf014f62ba0f60e6cf014f62ba0f60" +FAH_MODE="light"