Skip to content

Instantly share code, notes, and snippets.

#DELETE DUPLICATES
# Locate hosts in katello_systems and order themn
su - postgres -c "psql foreman -c \"select uuid,id from katello_systems ORDER BY uuid asc;\"" >/tmp/uuid.out
# In above we have 396 Duplicates Content hosts
# Take that data and uniquely sort out
sort | uniq -d -w 36 /tmp/uuid.out | wc -l
396
hammer host list --search "yourdomain.com" --per-page 100|grep yourEnvName|awk '{print $1}'|while read i; do hammer host update --id $i --domain-id 1 --subnet-id 1 --medium-id 7 --operatingsystem-id 2 --partition-table-id 13; done
#**************************************************************
# Version 0.3"
# Author: Jon Nikolakakis with assistance from Jamie Bainbridge
#**************************************************************
import time
correct = 0 # starting value as no values yet correct
index = 0 # starting the index at 0
# answers to all of the questions in array [0 to 8]
answers = ['false','d','mkdir','mount','d','c','b','a','d','a','a','ntp','fqdn','c']
questions = [
@jnikolak
jnikolak / gist:686298f0dc06b58d1f521b83d7ab907b
Created October 26, 2016 13:47
Auto generate Hostname on Rhel 7 and auto-add into /etc/hosts
#!/bin/bash
#### This script will create hostname for rhel 7 and add dns entries into /etc/hosts.
#### There is also a way to generate a random hostname, but the code is commented out.
#### Future version, will try to make it work for when user doesn't have any entry.
dom='.china.com'
old=$(hostname -f)
#This is if you want random letters.
#new2=$(tr -dc 'a-z0-9' < /dev/urandom | head -c12)
su - postgres -c "psql foreman -c \"select * from foreman_tasks_tasks where state = 'running' OR state = 'paused' OR state = 'planned';\""