Skip to content

Instantly share code, notes, and snippets.

View chelnak's full-sized avatar
👀
What's cooking?

Craig Gumbley chelnak

👀
What's cooking?
View GitHub Profile
@chelnak
chelnak / UBUNTU Static IP
Created February 25, 2015 09:20
UBUNTU Static IP
#Edit interfaces file
sudo nano /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
@chelnak
chelnak / prepare.sh
Last active August 29, 2015 14:15
prepare.sh
#!/bin/bash
#Prepare template for vRA deployments
#disable ipv6
echo "Disable ipv6"
echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6
#remove eth0 file
echo "Remove eth0 files"
@chelnak
chelnak / newuser.sh
Created February 18, 2015 10:20
newuser.sh
#!/bin/bash
#Create a new user based on script arguments
#Require password to be changed at first login
#Add user to sudo group
#usage ./newuser.sh user password
if [ $(id -u) -eq 0 ]; then
if [ -n "$(id "${1}" 2>/dev/null)" ];then
echo "${1} exists"
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
@chelnak
chelnak / rabbitmq.config
Last active August 29, 2015 14:15
vRA 6.2 rabbitmq.config
## In the document (P11, Strong Protocols) the following line ends with a comma. This will cause the serivce to fail.
## So -> {versions, ['tlsv1.2', 'tlsv1.1', tlsv1]},
## Should be -> {versions, ['tlsv1.2', 'tlsv1.1', tlsv1]}
## See below for correct config
[
{ssl, [{versions, ['tlsv1.2', 'tlsv1.1', tlsv1]}
]},
{rabbit, [
{ssl_listeners, [5672]},
@chelnak
chelnak / optparsexample.py
Created January 15, 2015 11:47
OptParse Example
#!/usr/bin/python
from optparse import OptionParser
#Setup OptionParser
parser = OptionParser()
parser.add_option("-n", "--host",dest="hostname",help="Hostname of server.")
parser.add_option("-g", "--hostgroups",dest="hostgroups",help="Hostgroup of a server")
(options,args) = parser.parse_args()
@chelnak
chelnak / vra-LeaseAboutToExpire.xslt
Last active August 29, 2015 14:11
vRA LeaseAboutToExpire.xslt date
<!-- This bit goes after <xsl:template match="/"> -->
<xsl:variable name="dd">
<xsl:value-of select="substring(//VirtualMachineEx/Expires, 9,2)" />
</xsl:variable>
<xsl:variable name="mm">
<xsl:value-of select="substring(//VirtualMachineEx/Expires, 6,2)" />
</xsl:variable>
@chelnak
chelnak / example.py
Last active August 29, 2015 14:10
vRAAPIClient example
#!/usr/bin/python
import getpass
import json
import os
from globalconfig import passwd, url, usr
from time import sleep
from sys import exit
from vraapiclient import catalog