This file contains hidden or 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 hidden or 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 hidden or 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/python | |
| import xmlrpclib,sys | |
| import socket | |
| SATELLITE_URL = "http://serverdnsname/rpc/api" | |
| #User account to connect to satellite server | |
| SATELLITE_LOGIN = "<user to delete account>" | |
| #Password for above connection | |
| SATELLITE_PASSWORD = "<password>" | |
| #Accept an argument |
This file contains hidden or 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
| import os, random, string, hashlib | |
| length = 23 | |
| chars = string.ascii_letters + string.digits + '!@#$%^&*()' | |
| rnd = random.SystemRandom() | |
| rpass = ''.join(rnd.choice(chars) for i in range(length)) | |
| m = hashlib.sha1() | |
| m.update(rpass) |
This file contains hidden or 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
| m = hashlib.sha512() | |
| m.update("your_password") | |
| print m.hexdigest() |
This file contains hidden or 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
| curl -k -X POST -H "Accept: application/json" \ | |
| -H "Accept: application/json" -H "Content-Type: application/json" \ | |
| -H "Cache-Control: no-cache" -u "username:password" \ | |
| -d ' | |
| { | |
| "host": { | |
| "name": "<instance_id>", | |
| "organization_id": 4, | |
| "location_id": 12, | |
| "hostgroup_id": <hostgroup_id>, |
This file contains hidden or 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
| require 'rubygems' | |
| require 'json' | |
| require 'faraday' | |
| if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.8.7') | |
| fail("Ruby >= 1.8.7 is required") | |
| end | |
| def which(cmd) | |
| exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] |
This file contains hidden or 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
| require 'facter' | |
| Facter.add("homedir_layout") do | |
| confine :osfamily => 'RedHat' | |
| setcode do | |
| if File.exists?("/home/local") | |
| layout = 'legacy' | |
| else | |
| layout = 'current' | |
| end |
This file contains hidden or 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
| class foo { | |
| case $::tier { | |
| 'websphere': { include '::foo::websphere' } | |
| 'dbora': { include '::foo::dbora' } | |
| 'monbot': { include '::foo::monbot' } | |
| 'tomcat': { include '::foo::tomcat' } | |
| default: { fail("blah blah blah") } | |
| } | |
| } |
This file contains hidden or 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
| class foo { | |
| $stype = $::tier | |
| if !defined("::foo::${stype}") { | |
| fail("The server type of ${::tier} is invalid") | |
| } | |
| include "::foo::${stype}" | |
| } |