ansible.yml

cat < /etc/ansible/test.yml
---
- hosts: all
tasks:
- debug: msg="{{ ansible_user_id }}@{{ inventory_hostname }}"
EOF

---
- hosts:
srv.example.com
remote_user: ubuntu
become: yes
tasks:
- name: Update all packages
apt:
update_cache: yes
upgrade: dist

- name: Show command output
command: id
register: out
- debug: var=out.stdout_lines

- name: print to stdout
command: id
register: print
- debug: msg="{{ print.stdout }}"
- debug: msg="{{ print.stderr }}"

- hosts: all
# p

Icinga CLI

schedule a service check
HOST_NAME=www.example.com
SERVICE_NAME=APT
/usr/bin/printf "[%lu] SCHEDULE_FORCED_SVC_CHECK;%s;%s;%s\n" $(date +%s) "${HOST_NAME}" "${SERVICE_NAME}" $(date +%s) | tee -a "${NAGIOS_CMD_SOCKET}"

schedule a host check
NAGIOS_CMD_SOCKET=/var/lib/icinga/rw/icinga.cmd
/usr/bin/printf "[%lu] SCHEDULE_HOST_CHECK;%s;%s\n" \
$(date +%s) \
"host_name" \
$(date +%s) | tee -a $NAGIOS_CMD_SOCKET

iDRAC (DELL)

user: dell
pass: calvin

Key mapping for console redirection
Use the <1> key sequence for
Use the <2> key sequence for (System Setup)
Use the <3> key sequence for
Use the <0> key sequence for (Lifecycle Controller)
Use the key sequence for (Boot Manager)
Use the <@> key sequence for (PXE Boot)

Management
# install ipmitool package on client (OPTIONAL)
sudo apt-get install -y ipmitool

# connect over SOL (Serial over LAN)
ipmitool -I lanplus -H -U -P sol acti

Create XEN LXC DomU

DOMAIN_NAME=lxc
DOMAIN_MAC=00:00:00:ef:11:cc
DOMAIN_RAM=2Gb
DOMAIN_HDD=128Gb

xen-create-image \
--hostname=${DOMAIN_NAME} \
--dist=xenial \
--lvm=vg1 \
--fs=ext4 \
--dhcp \
--pygrub \
--mac=${DOMAIN_MAC} \
--mirror=http://archive.ubuntu.com/ubuntu \
--size=${DOMAIN_HDD} \
--memory=${DOMAIN_RAM} \
--swap=${DOMAIN_RAM} \
--genpass=0 \
--password=t00r \
--vcpus $(cat /proc/cpuinfo | grep processor | wc -l)

mv /etc/xen/${DOMAIN_NAME}.cfg /etc/xen/${DOMAIN_NAME}
ln -s /etc/xen/${DOMAIN_NAME} /etc/xen/auto/12_lxc

mou

Json / jq

# processing Icinga warning Json list
PASSWORD=pass1234
URL="http://monitoring.example.com/cgi-bin/icinga/status.cgi?servicestatustypes=20&noheader=1&servicestatustypes=29&sorttype=2&sortoption=3&scroll=963&jsonoutput"

wget -q --user=${USER} --password=${PASSWORD} "${URL}" -O - | jq --raw-output ' .status.service_status[] | select(.host_name | contains("integration")) | select(.status_information | contains("Apache", "Java")) | .host_name'

jq 'select(.geo != null)' all.json

LTSP update kernel module

# on client: download driver
# Intel ixgbe (10G NIC)
wget https://downloadmirror.intel.com/14687/eng/ixgbe-4.4.6.tar.gz -qP /tmp

# Intel e1000e (1G NIC)
wget https://downloadmirror.intel.com/15817/eng/e1000e-3.3.4.tar.gz -qP /tmp
tar xzf /tmp/e1000e-3.3.4.tar.gz -C /tmp/

# install required packages
apt-get install build-essential linux-headers-$(uname -r)

# on client: compile
cd /tmp/e1000e-3.3.4/src/
make

# copy /tmp/e1000e-3.3.4/src/e1000e.ko to LTSP server

# debug on server
# make install
# rmmod e1000e
# modprobe e1000e
# update-initramfs -u

# backup original

Install SonarQube

<?php
$URL="https://raw.githubusercontent.com/panticz/installit/master/install.sonarqube.sh";
echo "wget $URL -O - | bash -";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

WebGUI
http://172.29.14.185:9000/

Logfile
tail -f /opt/sonar/logs/sonar.log

Links
http://sonar-pkg.sourceforge.net/
http://docs.sonarqube.org/display/SONAR/Requirements
https://github.com/Godin/sonar-native-packages
https://gist.github.com/micheleorsi/bd20912b2489f3432558