This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'xmlrpc/client' | |
require 'net/https' | |
require 'openssl' | |
#The following variables can take variables for puppet | |
@SATELLITE_URL = "serverurl/rpc/api" | |
@SATELLITE_LOGIN = "username" | |
@SATELLITE_PASSWORD = "password" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# facter rhelkey | |
# | |
# This fact will determine which patching group should be applied | |
# to the server when added to satellite so the need to manually | |
# add servers to groups will be eliminated. | |
Facter.add('rhelkey') do | |
setcode do | |
myenv = Facter.value('hostname').scan(/(^\D+\d)/).to_s | |
odd_even = Facter.value('hostname').scan(/^\D+\d\D+(\d+)/).to_s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!bin/bash | |
# | |
# chkconfig: 35 20 30 | |
# description: A problem exists when cloining a virtual machine | |
# that is currently up when using vmware. The problem | |
# this script solves is to remove the udev rule for | |
# networking. | |
# source function library | |
. /etc/rc.d/init.d/functions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Smart-class parameters are declared in your Puppet manifests. You will see them at the top of the manifest within (). They will be in the form of $variable = array/string/boolean/yaml/json/integer,. Arrays will be within [] with each object within either '' or "" depending on how they are to be interpreted. Strings will be within "" or '' depending on how they are to be interpreted. | |
Examples: | |
( $packages = ['package1', 'package2', 'package3'], | |
$ensure = 'running' | |
$enable = true | |
$path = "${libpath}/nagios",) | |
These are automatically imported into Foreman as Smart-Class parameters. Whatever value is set in the manifest (a value can be null) is the default value given to the parameter in Foreman. When a parameter requires a change in value (an override) you need to go to the Smart-Class parameter tab of either the class, host group or host. You will see a list of all the parameters available and which class they belong to. Simply click the override button for the parameter you wish to alter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cp /etc/vmware-tools/services.sh /etc/init.d/vmware-tools | |
vim /etc/init.d/vmware-tools | |
Paste the following just below the line ##VMWARE_INIT_INFO## and save: | |
chkconfig: 235 03 99 | |
chkconfig --add vmware-tools | |
chkconfig vmware-tools on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NSClient++ Version | |
Facter.add("NSClient_Version") do | |
confine :osfamily => "Windows" | |
setcode do | |
NSClient_Version = Facter::Util::Resolution.exec("command to pull version") | |
#only use the below if and while in the case of normalizing version numbers | |
#the below code is assuming symantec versioning is being used (ex. 3.5.1) | |
#if NSClient_Version.length < 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Disks to check for Nagios alerting | |
Facter.add("Check_Disks") do | |
confine :osfamily => "RedHat" | |
setcode do | |
Check_Disks = Facter::Util::Resolution.exec("cat /etc/nagios/check_disk.cfg | cut -c 9-19") | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This will pull the package version of the NRPE client | |
Facter.add("NRPE_Version") do | |
confine :osfamily => "RedHat" | |
setcode do | |
NRPE_Version = `/bin/rpm -q --queryformat "%{VERSION}" nrpe` | |
NRPE_Version | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This fact will pull securiy groups and users who have access if you are using PBIS. | |
Facter.add("Domain_Access") do | |
confine :osfamily => "RedHat" | |
setcode do | |
if File.directory? "/opt/likewise" | |
Domain_Access = `/opt/likewise/bin/lwconfig --detail RequireMembershipOf | grep '"' | sed -e 's/^"//' -e 's/"$//' | awk -F'\\' '{print $3}'` | |
$Access = split($Domain_Access, ' ') | |
Domain_Access | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#This script pulls the drive path and sets the check command for NRPE. It is outputted to a file that is included int he nrpe.cfg file. | |
rm -f check_disk.cfg 2> /dev/null; | |
df -H | grep "/dev" | awk {'print $1'}> out.txt | |
sed -i "s|tmpfs|/dev/shm|g" out.txt; | |
no="0" | |
while read line | |
do | |
no=$[$no+1] |