Skip to content

Instantly share code, notes, and snippets.

View vladbabii's full-sized avatar
💭
I may be slow to respond.

Vlad Babii vladbabii

💭
I may be slow to respond.
View GitHub Profile
@vladbabii
vladbabii / pedantically_commented_playbook.yml
Created September 26, 2016 19:46 — forked from marktheunissen/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@vladbabii
vladbabii / ubuntu_apt_no_cache.sh
Created January 13, 2017 13:41
Remove apt cached deb files
echo "DPkg::Post-Invoke {\"/bin/rm -f /var/cache/apt/archives/*.deb || true\";};" > /etc/apt/apt.conf.d/clean
@vladbabii
vladbabii / install_on_xenial_rabbitmq.sh
Created January 13, 2017 13:45
Install RabbitMQ on Ubuntu Xenial
# install erang first
# i use https://gist.github.com/vladbabii/704e14dadf6aef671ecb38bf6902a7cc
# then download the deb file from https://www.rabbitmq.com/install-debian.html
apt-get install socat logrotate init-system-helpers
# replace * with the version is you have downloaded multiple files
dpkg -i rabbitmq-server_*.deb
@vladbabii
vladbabii / rabbitmq_create_new_user_with_pass.sh
Created January 13, 2017 14:05
RabbitMQ 3.6.6+ create new admin user
# replace thenewusername thenewpassword ;)
rabbitmqctl add_user thenewusername thenewpassword
rabbitmqctl set_user_tags thenewusername administrator
rabbitmqctl set_permissions -p / thenewusername ".*" ".*" ".*"
@vladbabii
vladbabii / install_on_xenial_repcached.sh
Last active January 14, 2017 15:19
Install repcached on Ubuntu Xenial
wget https://downloads.sourceforge.net/project/repcached/repcached/2.2.1-1.2.8/memcached-1.2.8-repcached-2.2.1.tar.gz?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Frepcached%2Ffiles%2F&ts=1484404423&use_mirror=netix
mv memcached-1.2.8-repcached-2.2.1.tar.gz\?r\=https%3A%2F%2Fsourceforge.net%2Fprojects%2Frepcached%2Ffiles%2F memcached-1.2.8-repcached-2.2.1.tar.gz
tar xvf memcached-1.2.8-repcached-2.2.1.tar.gz
apt-get install libevent-dev g++ makelibevent1-dev
cd memcached-1.2.8-repcached-2.2.1
./configure --enable-replication
make
make install
ln -s /usr/local/bin/memcached /usr/bin/repcached
@vladbabii
vladbabii / keepalived.conf
Created January 14, 2017 21:42
keepalived multi-master (aka equal) with 2 or more services (in this case apache and repcached)
vrrp_script chk_apache2 {
script "/usr/bin/killall -0 apache2"
interval 2
fall 2
rise 2
weight 30
}
vrrp_script chk_repcached {
script "/usr/bin/killall -0 repcached"
@vladbabii
vladbabii / keepalived.conf
Created January 14, 2017 21:43
keepalived multi-master (aka equal) with 1 service or more services without priority
vrrp_script chk_apache2 {
script "/usr/bin/killall -0 apache2"
interval 2
fall 2
rise 2
}
vrrp_script chk_repcached {
script "/usr/bin/killall -0 repcached"
interval 2
@vladbabii
vladbabii / install_on_xenial_composer.sh
Created January 14, 2017 21:50
Install composer on Ubuntu Xenial
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
ln -s /usr/local/bin/composer /usr/bin/composer
@vladbabii
vladbabii / monit_repacched.conf
Created January 15, 2017 11:09
Monit repcached configuration
check process repcached
matching "repcached -d -m"
start program = "/usr/bin/repcached -d -m 256 -p 11211 -u root -P /var/run/memcachedrep.pid -l$
stop program = "/bin/kill -9 $(pidof repcached)"
if failed host 172.16.62.104 port 11211 type tcp then restart
@vladbabii
vladbabii / pi_minimal_packages_cleanup.sh
Created February 16, 2017 11:01
Raspberry Pi Cleanup
sudo apt-get -y remove `sudo dpkg --get-selections | grep -v "deinstall" | grep x11 | sed s/install//`
sudo apt-get -y remove `sudo dpkg --get-selections | grep -v "deinstall" | grep python | sed s/install//`
sudo apt-get -y remove `sudo dpkg --get-selections | grep -v "deinstall" | grep sound | sed s/install//`
sudo apt-get -y remove `sudo dpkg --get-selections | grep -v "deinstall" | grep gnome | sed s/install//`
sudo apt-get -y remove `sudo dpkg --get-selections | grep -v "deinstall" | grep lxde | sed s/install//`
sudo apt-get -y remove `sudo dpkg --get-selections | grep -v "deinstall" | grep gtk | sed s/install//`
sudo apt-get -y remove `sudo dpkg --get-selections | grep -v "deinstall" | grep desktop | sed s/install//`
sudo apt-get -y remove `sudo dpkg --get-selections | grep -v "deinstall" | grep gstreamer | sed s/install//`
sudo apt-get -y remove `sudo dpkg --get-selections | grep -v "deinstall" | grep avahi | sed s/install//`
sudo apt-get -y remove `sudo dpkg --get-selections | grep -v "deinstall" | gr