Skip to content

Instantly share code, notes, and snippets.

yum install -y libvirt
service libvirtd start
puppet module install -i /tmp domcleal/katellovirt
echo "Full NAT Forwarding"
cd /tmp/katellovirt/
grep -v virbr manifests/libvirt.pp > tempfile
cp tempfile manifests/libvirt.pp
@mccun934
mccun934 / dynflow_increase_workers.sh
Created May 10, 2017 16:50 — forked from iNecas/dynflow_increase_workers.sh
Increase number of workers for dynflow in Foreman
cat <<EOF > /usr/share/foreman/config/initializers/foreman_tasks_workers_bump.rb
workers_count = 10
Rails.logger.info("Bumping the number of dynflow worksers to #{workers_count}")
ForemanTasks.dynflow.config.pool_size = workers_count
EOF
service foreman-tasks restart
@mccun934
mccun934 / file_repogen.rb
Created May 17, 2017 15:33 — forked from jlsherrill/file_repogen.rb
Generate pulp file repos
#!/usr/bin/env ruby
def collect_files(files)
lines = []
files.collect do |file|
if File.lstat(file).symlink? && File.directory?(file)
sub_files = collect_files(Dir.glob("#{file}/**/*"))
lines.concat(sub_files)
next
elsif File.directory?(file)
@mccun934
mccun934 / debugging_errata.md
Created November 8, 2017 14:38 — forked from jlsherrill/debugging_errata.md
debugging errata issues

Run all of these in 'foreman-rake console'

Check the event queue:

Katello::Event.count

Check 'bound repositories' known to katello

@mccun934
mccun934 / gencerts.sh
Created November 14, 2017 20:10 — forked from JacobCallahan/gencerts.sh
Satellite certificate generator script
#! /bin/bash
git clone https://github.com/iNecas/ownca.git
cd ownca
yes "" | ./generate-ca.sh
yes | ./generate-crt.sh $(hostname)
certdir="$(pwd)/$(hostname)/"
cp cacert.crt $(hostname)/
cd $(hostname)
katello-certs-check -c "$(hostname).crt" -k "$(hostname).key" -r "$(hostname).crt.req" -b cacert.crt
@mccun934
mccun934 / sat-62-certs-regenerate.sh
Last active February 28, 2018 20:15
6.2 Certs Reset Regenerate
rm -rfv /etc/pki/katello{,.bak}
rm -rfv /etc/pki/katello-certs-tools{,.bak}
rm -rfv /etc/candlepin/certs/amqp{,.bak}
rm -rfv /etc/foreman-proxy/*ssl*
rm -rfv /etc/foreman/old-certs
rm -rfv /etc/foreman/*.pem
rm -rfv /var/lib/puppet/ssl
rm -rfv /root/ssl-build
satellite-installer --scenario satellite -v --certs-regenerate-ca=true --certs-regenerate=true
# EG : ALTER USER Postgres WITH PASSWORD '<newpassword>';
CP_PASS=`grep jpa.config.hibernate.connection.password /etc/candlepin/candlepin.conf | awk -F= '{print $2}'`
F_PASS=`grep password /etc/foreman/database.yml | awk -F: '{print $2}' | sed 's/"//g'`
echo "ALTER USER candlepin WITH PASSWORD '$CP_PASS';" | sudo -u postgres psql
echo "ALTER USER foreman WITH PASSWORD '$F_PASS';" | sudo -u postgres psql
@mccun934
mccun934 / mongodb_collection_sizes.js
Last active August 13, 2018 17:50 — forked from joeyAghion/mongodb_collection_sizes.js
List mongodb collections in descending order of size. Helpful for finding largest collections. First number is "size," second is "storageSize."
function getReadableFileSizeString(fileSizeInBytes) {
var i = -1;
var byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB'];
do {
fileSizeInBytes = fileSizeInBytes / 1024;
i++;
} while (fileSizeInBytes > 1024);
return Math.max(fileSizeInBytes, 0.1).toFixed(1) + byteUnits[i];
namespace :taskbench do
desc <<~END_DESC
Loads up some tasks
END_DESC
def parallelize(param_lists)
max_number_of_forks ||= ENV['forks'].to_i || 10
page = 0
page_size = param_lists.length/max_number_of_forks
@mccun934
mccun934 / deleted_puppet_envs65-later.md
Last active February 1, 2023 19:35 — forked from jlsherrill/deleted_puppet_envs.md
recover from deleted puppet environments from 6.5 or later

when publishing a content view if you get:

Validation failed: Puppet environment can't be blank

or

ActiveRecord::RecordInvalid: Validation failed: Name has already been taken