Skip to content

Instantly share code, notes, and snippets.

View sshnaidm's full-sized avatar
🍺
it's coding

Sergey sshnaidm

🍺
it's coding
View GitHub Profile
#version=RHEL7
# System authorization information
auth --enableshadow --passalgo=sha512 --enablefingerprint
# Install OS instead of upgrade
install
# Reboot after installation
shutdown
# Use network installation - choose your mirror
url --url='http://mirror.isoc.org.il/pub/centos/7/os/x86_64/'
# Use text mode install
#!/bin/bash
CURDIR=$HOME/virtual
PREFIX=${1:-""}
IMGS=/home/imgs/
KS_PATH=$CURDIR/multinode.ks
URL="http://mirror.isoc.org.il/pub/centos/7/os/x86_64/"
# Install dependencies
# sudo yum install -y virt-install
#!/bin/bash
REGISTRY_PORT=5000
CACHE_DIR=$HOME/docker_cache
mkdir -p $CACHE_DIR
chmod a+rwX $CACHE_DIR
yum install docker -y
cat <<EOF >$CACHE_DIR/config.yml
@sshnaidm
sshnaidm / generate_data_for_influxdb.py
Last active January 16, 2018 12:24
generate data for influxdb
import random, time
def get_data():
d = {
'branch': random.choice(["master"]*3 + ["pike", "ocata"]),
'cloud': random.choice(["rdo-cloud", "rh1", "infra1", "infra2"]),
'pipeline': random.choice(["check"]*2 + ["periodic", "gate"]),
'toci_jobtype': random.choice(['ovb-ha-oooq']*2 + ['multinode-2ctlr-featureset032', 'multinode-1ctlr-featureset016']),
'job_duration': random.randrange(7200, 10800),
'logs_size': random.randrange(10, 27),
'testenv_prepare': random.randrange(300, 700),
@sshnaidm
sshnaidm / fpaste_install
Created January 5, 2017 12:23
fpaste install on CentOS
sudo yum install -y https://kojipkgs.fedoraproject.org//packages/fpaste/0.3.7.4/1.fc21/noarch/fpaste-0.3.7.4-1.fc21.noarch.rpm
@sshnaidm
sshnaidm / dump_ansible_vars.yaml
Created September 21, 2016 06:17
dump all ansible variables
tasks:
- name: Dump all vars
action: template src=templates/dumpall.j2 dest=/tmp/ansible.all
dumpall.j2:
Module Variables ("vars"):
--------------------------------
{{ vars | to_nice_json }}
@sshnaidm
sshnaidm / jenkins_plugins
Created June 15, 2016 11:47
Bulk install Jenkins plugins
for l in $(cat ~/jenkins_plugins.csv);
do
plugin=$(echo $l | cut -d";" -f1);
version=$(echo $l | cut -d";" -f2);
echo "Installing $plugin with version $version";
arg="<install plugin=\"${plugin}@${version}\" />";
cmd="curl -XPOST http://localhost:8080/pluginManager/installNecessaryPlugins -d ""'$arg'";
$cmd;
done
@sshnaidm
sshnaidm / service_restart_overcloud
Last active June 15, 2016 22:30
restarting services on all overcloud nodes
for server in $(grep controller /etc/hosts | grep 192.0. | awk {'print $3'}); do ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -ttt heat-admin@$server "for service in \$(sudo systemctl list-units | grep openstack-heat | awk {'print \$1'}); do echo Restarting \$service; sudo systemctl restart \$service; done"; done
@sshnaidm
sshnaidm / history_screen
Created June 12, 2016 09:39
History with byobu/screen
# History between sessions
shopt -s histappend
HISTSIZE=10000
HISTFILESIZE=$HISTSIZE
HISTCONTROL=ignorespace:ignoredups
HISTTTIMEFORMAT="%F %T"
export HISTFILESIZE HISTSIZE HISTCONTROL HISTTIMEFORMAT
[ -r /home/sshnaidm/.byobu/prompt ] && . /home/sshnaidm/.byobu/prompt
@sshnaidm
sshnaidm / updateip.sh
Created May 25, 2016 09:25
update ip with mail
#!/bin/sh
function get_my_ip (){
myint=$(ip r | grep default | grep -Eo "dev .*" | sed "s/dev //g" | tr -d " ")
echo $(ip a | grep "${myint}:" -A7 | grep "inet " | head -1 | awk {'print $2'} | cut -d"/" -f1)
}
function sendipmail () {
newip=$1
nc smtp.redhat.com 25 <<EOF