Skip to content

Instantly share code, notes, and snippets.

View elasticsearch-river-mongodb.pp
class elasticsearch-river-mongodb ($version = '1.6.8') {
exec {'elasticsearch-mapper-attachment':
require => Package['elasticsearch'],
command => '/usr/share/elasticsearch/bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/1.7.0',
creates => '/usr/share/elasticsearch/plugins/mapper-attachments/elasticsearch-mapper-attachments-1.7.0.jar',
exec {'elasticsearch-river-mongodb':
require => Exec['elasticsearch-mapper-attachment'],
EmmanuelKasper / kvm-autostable
Last active Feb 21, 2018
A script to automatically install Debian Wheezy on a KVM guest
View kvm-autostable
# You can optionally connect to the VM with
# virt-viewer -c qemu:///system Debian7
export OS=Debian7
virt-install \
--connect qemu:///system \
--name ${OS} \
--ram 1024 \
--vcpus 1 \
EmmanuelKasper / qemu-autostable-serial
Created Jul 3, 2013
Automatic Debian7 installation on qemu, using libvirt, the debian installer and a preseed file, inside a terminal (ie you can start it on a remote server)
View qemu-autostable-serial
export OS=Debian7
virt-install \
--connect qemu:///system \
--name ${OS} \
--ram 512 \
--vcpus 1 \
--file ${OS}.img \
EmmanuelKasper / ansibleForVagrantboxes
Last active Dec 25, 2015
If you've just downloaded one of the vagrant base boxes from, this gist shows you how to tame them with ansible
View ansibleForVagrantboxes
# create a temporary inventory file
echo "vagrant ansible_ssh_host=localhost ansible_ssh_user=vagrant ansible_ssh_port=2222" > hosts
# run a root shell in the vagrant env
ansible \
--inventory hosts \
--private-key=/opt/vagrant/embedded/gems/gems/vagrant-1.2.7/keys/vagrant \
--sudo \
--args "id" vagrant
View postgres backup all
# to be run as postgres user
# a database should be restored as posgres user with
# dropdb popcon
# createdb --encoding=UNICODE --owner=popcon popcon
# psql popcon < popcon.psql
set -e
do_bkp() {
/usr/bin/pg_dump -U postgres --column-inserts --file=/var/backups/postgres/$i.psql $i
EmmanuelKasper / backup_postgres
Last active Dec 27, 2015
cron.daily entry for postgres backup all
View backup_postgres
su -l postgres -c /usr/local/sbin/backup_postgres
# a nice comment
EmmanuelKasper / backup_vhosts
Last active Dec 27, 2015
Simple backup of all Virtual Hosts
View backup_vhosts
[ -d /var/backups/vhosts ] || mkdir /var/backups/vhosts
for VHOST in *; do
if [ "$VHOST" != "" ]; then
tar cpzf /var/backups/vhosts/$VHOST.tar.gz $VHOST
EmmanuelKasper / Puppet Canonical
Last active Jan 3, 2016
A canonical puppet deployment file, based on the package / file /service hierarchy
View Puppet Canonical
class amanda {
package { "amanda-client":
ensure => installed,
before => File['/etc/amandahosts'],
file { "/etc/amandahosts":
ensure => file,
owner => "backup",
group => "backup",
EmmanuelKasper / EFI boot on Lenovo Thinkcenter M92Z
Last active Jan 16, 2021
EFI boot on Lenovo Thinkcenter M92Z
View EFI boot on Lenovo Thinkcenter M92Z
# disable secure boot in the bios, in menu security
# downlad and unzip
# install refind, assuming your ESP partition is /dev/sda1 and mounted in /boot/efi
cd refind-bin-0.7.8
# type y and go ahead
# at that time your boot entry should look like that
View dist-play-app-initd
# =========================================================================
# Copyright 2014 Rado Buransky, Dominion Marine Media
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at