Skip to content

Instantly share code, notes, and snippets.

View chris1984's full-sized avatar

Chris Roberts chris1984

View GitHub Profile
@chris1984
chris1984 / pingsweep.ps1
Created March 27, 2018 20:34 — forked from jimfdavies/pingsweep.ps1
Quick script to ping a subnet and report if each IP address is used or 'empty'. Can be extended to redirect to a file if desired.
$subnet24 = "10.10.1"
1..254 |
foreach-object {
$ip = $subnet24 + "." + $_
if (test-connection $ip -count 1 -quiet) { Write-Host "USED:$ip" } else { Write-Host "EMPT:$ip" }
}
#USED:10.10.2.1
#EMPT:10.10.2.2
@chris1984
chris1984 / vmware_case.ps1
Created September 12, 2018 17:13
vmware_case.ps1
Connect-VIServer -Server vcenter.server.example.com -User admin_user -Password "password"
Write-Host "Gathering clusters"
Get-Cluster
Get-Cluster | Get-ResourcePool
$cluster = Get-Cluster "cluster_name" | Get-View
$cluster
$cluster.Configuration.DrsConfig
$cluster.Configuration.DasConfig
#!/usr/bin/env ruby
require 'fog'
client = ::Fog::Compute.new(
:provider => 'vsphere',
:vsphere_username => '',
:vsphere_password => '',
:vsphere_server => '',
:vsphere_expected_pubkey_hash => '',
@chris1984
chris1984 / vmware-info.ps1
Created January 31, 2019 21:28
vmware-info.ps1
Connect-VIServer -Server <vcenterfqdn> -User <adminuser> -Password <adminpassword>
Write-Host "Gathering clusters and ESXi hosts"
$sleep = 1
Get-Cluster
Get-VMHost | Select Name, @{N="Cluster";E={Get-Cluster -VMHost $_}}
Write-Host "------------Finish Cluster/ESXi collection--------"
Write-Host "Gathering information on Distributed Switches"
$sleep = 1
@chris1984
chris1984 / vm-clone.patch
Last active December 17, 2019 17:16
vm-clone.patch
diff --git a/app/models/compute_resources/foreman/model/vmware.rb b/app/models/compute_resources/foreman/model/vmware.rb
index 58b6d9c..5bd8df3 100644
--- a/app/models/compute_resources/foreman/model/vmware.rb
+++ b/app/models/compute_resources/foreman/model/vmware.rb
@@ -447,10 +447,14 @@ module Foreman::Model
args = parse_networks(args)
args = args.with_indifferent_access
if args[:provision_method] == 'image'
+ Rails.logger.error "VMW: args #{args.inspect}"
clone_vm(args)
@chris1984
chris1984 / katello-remove.rb
Created September 4, 2019 16:39
Katello Remove
#!/usr/bin/env ruby
require 'optparse'
require 'fileutils'
options = {}
optparse = OptionParser.new do |opts|
opts.banner = """
This script is used to remove all Katello related packages and services.
This should only be used if you are sure you are wanting to completly remove Katello from this machine and lose all of your settings and synced content.\n
@chris1984
chris1984 / dswrite.ps1
Last active October 23, 2019 19:11
Test datastore permissions
<#
.SYNOPSIS
Create a folder on a datastore
.DESCRIPTION
Script used to test folder creation on a datastore with a user account. This will test permissions as well as provide debug output
for foreman_bootdisk debugging
Replace Line# 19 with your vCenter URL and username/password you are going to authenticate with
Replace Line# 21 Datastore1 with the datastore you are wanting to test against
Replace Line# 20/21 with username in Windows found in C:/Users/
.NOTES
@chris1984
chris1984 / seed.sh
Created March 24, 2021 13:55
Hammer Seed
echo 'Enabling Red Hat Ansible Engine 2.9 RPMs for Red Hat Enterprise Linux 7 Server'
hammer repository-set enable --name "Red Hat Ansible Engine 2.9 RPMs for Red Hat Enterprise Linux 7 Server" --organization-id 1 --basearch "x86_64"
echo 'Enabling Red Hat Satellite Capsule 6.8 (for RHEL 7 Server) (RPMs)'
hammer repository-set enable --name "Red Hat Satellite Capsule 6.8 (for RHEL 7 Server) (RPMs)" --organization-id 1 --basearch "x86_64"
echo 'Enabling Red Hat Satellite Maintenance 6 (for RHEL 7 Server) (RPMs)'
hammer repository-set enable --name "Red Hat Satellite Maintenance 6 (for RHEL 7 Server) (RPMs)" --organization-id 1 --basearch "x86_64"
echo 'Enabling Red Hat Satellite Tools 6.3 - Puppet 4 (for RHEL 6 Server) (RPMs)'
@chris1984
chris1984 / export.sh
Created March 24, 2021 15:14
Export-seed
echo 'Enabling Red Hat Ansible Engine 2.9 RPMs for Red Hat Enterprise Linux 7 Server'
hammer repository-set enable --name "Red Hat Ansible Engine 2.9 RPMs for Red Hat Enterprise Linux 7 Server" --organization-id 1 --basearch "x86_64"
echo 'Enabling Red Hat Satellite Capsule 6.8 (for RHEL 7 Server) (RPMs)'
hammer repository-set enable --name "Red Hat Satellite Capsule 6.8 (for RHEL 7 Server) (RPMs)" --organization-id 1 --basearch "x86_64"
echo 'Enabling Red Hat Satellite Maintenance 6 (for RHEL 7 Server) (RPMs)'
hammer repository-set enable --name "Red Hat Satellite Maintenance 6 (for RHEL 7 Server) (RPMs)" --organization-id 1 --basearch "x86_64"
echo 'Enabling Red Hat Satellite Tools 6.3 - Puppet 4 (for RHEL 6 Server) (RPMs)'
@chris1984
chris1984 / upload_package_to_repo.sh
Last active September 23, 2022 13:27
upload_package_to_repo.sh
if [ $# -lt 2 ]; then
echo "too few arguments"
exit
fi
repoid=${1}
package=${2}
pkgname=${package##*/}
creds=admin:redhat
saturl=$(hostname -f)