Skip to content

Instantly share code, notes, and snippets.

View jcpowermac's full-sized avatar

Joseph Callen jcpowermac

View GitHub Profile
@jcpowermac
jcpowermac / disable_hardacclmove.ps1
Created December 11, 2013 18:47
Disable Hardware Accelerated Move
$vcenterhost = "vcenter_host"
# Set to zero (0) to disable or one (1) to enable.
$intValue = 0;
set-PowerCLIConfiguration -DefaultVIServerMode multiple -Confirm:$false;
Connect-VIServer -Server $vcenterhost
Write-Host -BackgroundColor Red -ForegroundColor White "*** Prompting for ESX(i) host password ***";
$cred = Get-Credential
$vmhosts = Get-VMHost
@jcpowermac
jcpowermac / copy_gz_from_esxi.ps1
Created December 11, 2013 18:49
Copy gzip files from ESXi
Add-PSSnapin VMware.VimAutomation.Core
$basedir = "C:\Desktop\ESXTOP-04032012-130000\";
if( !(Test-Path $basedir) ){
New-Item -Type Directory $basedir
}
$datastores = Get-Datastore -VMHost (get-vmhost) | Where {$_.Name.Contains("-local") }
foreach( $ds in $datastores ) {
@jcpowermac
jcpowermac / unconnected_network_vm.ps1
Created December 11, 2013 18:50
Virtual machines that are not connected to their network
$vmview = Get-View -ViewType VirtualMachine
$vmview | % {
if( $_.Runtime.PowerState -eq "poweredOn" ) {
$netdev = $_.Config.hardware.Device | Where {$_.MacAddress}
if(!($netdev.Connectable.Connected) ) {
$hostname = (Get-View -id $_.Runtime.Host).Name
Write-Host $_.Name $netdev.Backing.Port.PortKey $hostname
}
MAC=`ip link | grep "link/ether" | awk '{print $2}'`
echo "HWADDR=$MAC" >> /etc/sysconfig/network-scripts/ifcfg-ens192
/***
*
* Code from: http://sourceforge.net/p/wimlib/code/ci/master/tree/programs/imagex.c
* http://sourceforge.net/p/wimlib/code/ci/master/tree/src/xml.c
*/
#include <wimlib.h>
#include <wimlib_tchar.h>
#include <ctype.h>
This guide is for individuals just want to get Hanlon installed and running quickly. We are using Ubuntu LTS 14.04 but should also work with previous releases.
Lets first install git, mongodb, dhcpd, tftpd, ipxe installed:
```bash
root@hanlon:/# apt-get install -y git make mongodb openjdk-7-jre-headless g++ isc-dhcp-server ipxe tftp tftpd curl
```
For Windows testing only
```bash
apt-get install samba apache2 -y
diff -rupN org_ipxe/src/config/general.h ipxe/src/config/general.h
--- org_ipxe/src/config/general.h 2014-06-11 08:07:39.193081793 -0400
+++ ipxe/src/config/general.h 2014-06-10 15:15:30.628188405 -0400
@@ -111,7 +111,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
//#define IMAGE_PXE /* PXE image support */
//#define IMAGE_SCRIPT /* iPXE script image support */
//#define IMAGE_BZIMAGE /* Linux bzImage image support */
-//#define IMAGE_COMBOOT /* SYSLINUX COMBOOT image support */
+#define IMAGE_COMBOOT /* SYSLINUX COMBOOT image support */
//#define IMAGE_EFI /* EFI image support */
module ProjectHanlon
module ModelTemplate
class Redhat7 < Redhat
include(ProjectHanlon::Logging)
def initialize(hash)
super(hash)
# Static config
@hidden = false
cat > /etc/yum.repos.d/epel.repo << EOF
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
diff --git a/core/image_service/base.rb b/core/image_service/base.rb
index 90433cb..be09592 100644
--- a/core/image_service/base.rb
+++ b/core/image_service/base.rb
@@ -9,7 +9,7 @@ module ProjectHanlon
MOUNT_COMMAND = (Process::uid == 0 ? "mount" : "sudo -n mount")
UMOUNT_COMMAND = (Process::uid == 0 ? "umount" : "sudo -n umount")
- # I absolutely do not like hardcoding this
+ # TODO - determine another method for providing the path to 7z, configuration file?