Skip to content

Instantly share code, notes, and snippets.

View sdorsett's full-sized avatar

Stan Dorsett sdorsett

View GitHub Profile
@sdorsett
sdorsett / gist:fa89f3373b64178a8e0462f90e9eaa4c
Last active January 17, 2017 15:18
puppetserver standup on CentOS 6
yum update -y
rpm -Uvh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-6.noarch.rpm
yum install puppetserver
echo 'export PATH=/opt/puppetlabs/puppet/bin/:$PATH' >> /etc/profile
source /etc/profile
service puppetserver restart
chkconfig puppetserver on
/opt/puppetlabs/puppet/bin/gem install r10k
cd /etc/puppetlabs/puppet
@sdorsett
sdorsett / gist:8e54e521f87b077ca5ce0961828f1556
Created January 17, 2017 15:20
install git and ruby from source on CentOS 7
# install the dependencies
yum groupinstall -y development tools
yum install -y curl-devel expat-devel gettext-devel nss openssl-devel perl-devel tar zlib-devel libxml2 libxml2-devel libxslt libxslt-devel
yum clean all
# install git 2.10.2
curl https://www.kernel.org/pub/software/scm/git/git-2.10.2.tar.gz | tar xz
cd git-2.10.2
make prefix=/usr/local
make prefix=/usr/local install
@sdorsett
sdorsett / README
Created February 9, 2017 21:17 — forked from ganthore/README
See README below.
INSTALLATION
Copy jenkins-slave.init to /etc/init.d/jenkins-slave and copy jenkins-slave to /etc/sysconfig/jenkins-slave.
cp jenkins-slave.init /etc/init.d/jenkins-slave
cp jenkins-slave /etc/sysconfig/jenkins-slave
chkconfig jenkins-slave on
service jenkins-slave start
Change the values of /etc/sysconfig/jenkins-slave to match your environment needs.
@sdorsett
sdorsett / gist:904a7e91a04c8e7a7f8590366ef9ed1a
Created February 10, 2017 21:23
rbvmomi - find all virtual machines with 'desktop' in the name
require 'rbvmomi'
hostname = '192.168.1.200';
username = 'user1@vsphere.local';
password = 'P@ssword123';
vim = RbVmomi::VIM.connect host: hostname, user: username, password: password, insecure: true;
rootFolder = vim.serviceInstance.content.rootFolder
viewManager = vim.serviceInstance.content.viewManager
viewManager.CreateContainerView(
@sdorsett
sdorsett / docker_cleanup.sh
Created May 2, 2017 15:24
bash script to help docker clean up after itself
#!/bin/bash
# this script can be scheduled to run daily at midnight by adding a cron job like the following:
# 0 0 * * * /root/docker_cleanup.sh
#
docker rm -v $(docker ps -a -q -f status=exited) | logger -t "docker_cleanup.sh"
docker rmi $(docker images -f "dangling=true" -q) | logger -t "docker_cleanup.sh"
docker volume rm $(docker volume ls -qf dangling=true) | logger -t "docker_cleanup.sh"
@sdorsett
sdorsett / gist:7cddb69ec8cf194a8fd47210f2670e4d
Last active August 1, 2017 15:58
rbvmomi - find vnic IP addresses for hosts in a cluster
require 'rbvmomi'
credentials = { :host => "192.168.1.10", :user => "administrator@vsphere.local", :password => "vmware", :insecure => true }
vim = RbVmomi::VIM.connect(credentials)
datacenter = vim.rootFolder.childEntity.first # grab the first datacenter
datacenter.hostFolder.childEntity # this will return an array of all the clusters in the datacenter
cluster = datacenter.hostFolder.childEntity.first # grab the first cluster from the datacenter
cluster.host # this will return an array of all the ESXi hosts in the first cluster
host = cluster.host.first # grab the first host in the cluster
host.config.network.vnic # display all the vnics on the host
@sdorsett
sdorsett / vnic_info.rb
Last active August 1, 2017 17:40
rbvmomi - find vnic info for all ESXi hosts in all clusters in all datacenters
require 'rbvmomi';
credentials = { :host => "192.168.1.10", :user => "administrator@vsphere.local", :password => "vmware", :insecure => true };
vim = RbVmomi::VIM.connect(credentials);
datacenters = {};
vim.rootFolder.childEntity.each { |datacenter|
datacenter_info = {}
datacenter.hostFolder.childEntity.each { |cluster|
cluster_info = {}
cluster.host.each { |host|
host_info = {}
@sdorsett
sdorsett / gist:48f15fe784ebd322e49e6fbb68b30786
Created August 7, 2017 20:24
vagrant - create vmware_ovf format .box file from vmware_desktop format .box file
vagrant box add bento/centos-7.3
ls ~/.vagrant.d/boxes/bento-VAGRANTSLASH-centos-7.3/2.3.5/vmware_desktop/*.vmx
mkdir ~/.vagrant.d/boxes/bento-VAGRANTSLASH-centos-7.3/2.3.5/vmware_ovf/
ovftool -tt=ovf /root/.vagrant.d/boxes/bento-VAGRANTSLASH-centos-7.3/2.3.5/vmware_desktop/centos-7.3-x86_64.vmx ~/.vagrant.d/boxes/bento-VAGRANTSLASH-centos-7.3/2.3.5/vmware_ovf/centos-7.3-x86_64.ovf
echo '{"provider":"vmware_ovf"}' >> ~/.vagrant.d/boxes/bento-VAGRANTSLASH-centos-7.3/2.3.5/vmware_ovf/metadata.json
touch ~/.vagrant.d/boxes/bento-VAGRANTSLASH-centos-7.3/2.3.5/vmware_ovf/Vagrantfile
cd ~/.vagrant.d/boxes/bento-VAGRANTSLASH-centos-7.3/2.3.5/vmware_ovf/
tar cvzf /root/centos-7.3-vmware_ovf-1.0.box ./*
vagrant box add ~/centos-7.3-vmware_ovf-1.0.box --name centos-7.3
@sdorsett
sdorsett / gist:8eab3721e17daf3bd595370d3f5bab16
Last active January 14, 2020 03:02
Golang newbie resources from gophers.slack.com
Here are some resources you should check out if you are learning / new to Go:
First you should take the language tour: http://tour.golang.org/
Then, you should visit:
https://golang.org/doc/code.html to learn how to organize your Go workspace
https://golang.org/doc/effective_go.html be more effective at writing Go
https://golang.org/ref/spec learn more about the language itself
https://golang.org/doc/#articles a lot more reading material
There are some awesome websites as well:
@sdorsett
sdorsett / Vagrantfile
Created September 20, 2017 14:48
Vagrantfile and script files for installing powercli core on Centos 7 vm using vagrant-vcenter provider
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure('2') do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
config.vm.define :'centos7-powercli' do |m|
m.vm.box = 'standorsett/centos-7'