Skip to content

Instantly share code, notes, and snippets.

View fatmcgav's full-sized avatar

Gavin Williams fatmcgav

View GitHub Profile
@fatmcgav
fatmcgav / netapp.pp
Created February 5, 2013 11:28
Example defined types...
define act::env::oracle::instance::netapp {
...
->
oraenvs::add { "${oracle_sid}_showenvs":
content => template('act/linux/oracle/oraenvs-instance.erb')
}
->
tnsnames::add { "${oracle_sid}_tnsnames":
content => template('act/linux/oracle/tnsnames-instance.erb')
}
@fatmcgav
fatmcgav / nfs_mount.pp
Last active December 12, 2015 05:28
Database remove defined type.
# Define: act::util::linux::nfs_mount
#
# This define manages nfs mounts on linux.
#
# Parameters:
#
# Actions:
#
# Requires:
#
@fatmcgav
fatmcgav / oracle_clones.rb
Last active December 14, 2015 16:29
Oracle Clones fact
# Get a list of running dbs...
running_dbs = Facter::Util::Resolution.exec("ps -ef |grep [o]ra_pmon |awk {'print $8'} |awk 'BEGIN{FS=\"_\";} {print $3}'")
unless running_dbs.nil? or running_dbs.empty?
running_dbs.each do |db|
if (db =~ /REPC/)
# Need to get the export path
mount_point = Facter::Util::Resolution.exec("grep #{db} /etc/fstab | awk {'print $1'}")
# Add fact
Facter.add("clone_#{db}") do
@fatmcgav
fatmcgav / log file
Last active December 15, 2015 11:49
Prefetch with additional array item :S
Debug: Prefetching netapp_qtree resources for netapp_qtree
Debug: Puppet::Provider::Netapp_qtree: Got to self.prefetch.
Debug: Puppet::Provider::Netapp_qtree: got to self.instances.
Debug: Qtree_list looks like:
Debug: <qtrees>
<qtree-info>
<volume>v_puppet_test3</volume>
<qtree></qtree>
<id>0</id>
<oplocks>enabled</oplocks>
@fatmcgav
fatmcgav / delete_export.rb
Created July 15, 2013 10:32
delete_export.rb File to test NetApp export deletion...
$:.unshift '../../../../lib/ruby/NetApp'
require 'sdk/NaServer'
require 'rubygems'
require 'pp'
#require 'ap'
def print_usage
print ("Usage: \n")
print ("ruby delete_export.rb <storage> <user> <password>")
print (" <export name> \n")
@fatmcgav
fatmcgav / after
Created July 16, 2013 10:33
before and after output when patching NaServer SDK
$ ruby delete_export.rb 192.168.168.10 root netapp1234 /vol/v_puppet_test1007131448.
Pathname_info looks like:
#<NaElement:0x7f6dfd6e2798
@attrkeys=[],
@attrvals=[],
@children=
[#<NaElement:0x7f6dfd6e2680
@attrkeys=[],
@attrvals=[],
@children=[],
@fatmcgav
fatmcgav / F5 Debug log
Last active December 20, 2015 04:19
Puppet F5 Device testing...
Jul 24 11:43:54 actint-star-f501 debug iControlPortal.cgi[19189]: Portal: User: gavinw, Folder: /Common
Jul 24 11:43:54 actint-star-f501 debug iControlPortal.cgi[19189]: LocalLB:+++++++++++++++new+++++++++++++++++++
Jul 24 11:43:54 actint-star-f501 debug iControlPortal.cgi[19189]: LocalLB:Rule::get_list called by user "gavinw"
Jul 24 11:43:54 actint-star-f501 debug iControlPortal.cgi[19189]: LocalLB:+++++++++++++++new+++++++++++++++++++
Jul 24 11:43:54 actint-star-f501 debug iControlPortal.cgi[19189]: tpc:in GI::GetProto for name rule_name_SEQ, factory ptr is 586f3e42 (tag is 1083)
Jul 24 11:43:54 actint-star-f501 debug iControlPortal.cgi[19189]: tpc:lookup result for name rule_name_SEQ, my ptr 8692c18
Jul 24 11:43:55 actint-star-f501 debug iControlPortal.cgi[19189]: icontrol_portal:<?xml version="1.0" encoding="utf-8" ?> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Body
@fatmcgav
fatmcgav / kickstart-script
Created October 24, 2013 10:55
Foreman Kickstart script
install
<%= @mediapath %>
lang en_GB.UTF-8
selinux --permissive
keyboard uk
skipx
<% if @host.ip -%>
network --bootproto=static --ip=<%= @host.ip %> --netmask=<%= @host.subnet.mask %> --gateway=<%= @host.subnet.gateway %> --nameserver=<%= @host.subnet.dns_primary %> --hostname=<%= @host %>
<% else -%>
network --bootproto=dhcp --hostname <%= @host %>
@fatmcgav
fatmcgav / Puppet apply debug
Created November 25, 2013 14:27
Puppet apply debug output for installing package without an existing versionlock entry.
$ sudo puppet apply -e "package {'dos2unix': ensure => latest }" -d
...
Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
Info: Loading facts in /var/lib/puppet/lib/facter/pe_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/concat_basedir.rb
Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
Info: Loading facts in /var/lib/puppet/lib/facter/oracle_clones.rb
Info: Loading facts in /var/lib/puppet/lib/facter/oracle_db_homes.rb
Info: Loading facts in /var/lib/puppet/lib/facter/iptables_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/smo_version.rb
@fatmcgav
fatmcgav / failure-trace.log
Last active December 30, 2015 11:09
rspec-puppet failure point
Failure/Error: it { should_not contain_class('act::software::hp::psp') }
Puppet::Error:
Puppet::Parser::AST::Resource failed with error TypeError: can't convert Hash into String at /etc/puppet/environments/common/act/spec/fixtures/modules/act/manifests/software/linux/puppet_agent.pp:27 on node puppet-dev.card.co.uk
# /usr/lib/ruby/site_ruby/1.8/puppet/indirector/hiera.rb:21:in `exist?'
# /usr/lib/ruby/site_ruby/1.8/puppet/indirector/hiera.rb:21:in `hiera_config'
# /usr/lib/ruby/site_ruby/1.8/puppet/indirector/hiera.rb:32:in `hiera'
# /usr/lib/ruby/site_ruby/1.8/puppet/indirector/hiera.rb:36:in `hiera'
# /usr/lib/ruby/site_ruby/1.8/puppet/indirector/hiera.rb:12:in `find'
# /usr/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb:197:in `find'
# /usr/lib/ruby/site_ruby/1.8/puppet/resource.rb:331:in `lookup_external_default_for'