Skip to content

Instantly share code, notes, and snippets.

View EmmanuelKasper's full-sized avatar

Emmanuel Kasper EmmanuelKasper

  • Vienna, Austria
View GitHub Profile
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
EmmanuelKasper / kvm-autostable
Last active February 21, 2018 09:28
A script to automatically install Debian Wheezy on a KVM guest
#!/bin/sh
# 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
EmmanuelKasper / qemu-autostable-serial
Created July 3, 2013 15:38
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)
#!/bin/sh
export OS=Debian7
virt-install \
--connect qemu:///system \
--name ${OS} \
--ram 512 \
--vcpus 1 \
--file ${OS}.img \
@EmmanuelKasper
EmmanuelKasper / ansibleForVagrantboxes
Last active December 25, 2015 17:29
If you've just downloaded one of the vagrant base boxes from http://www.vagrantbox.es/, this gist shows you how to tame them with ansible
# 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
#!/bin/sh
# 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
EmmanuelKasper / backup_postgres
Last active December 27, 2015 09:09
cron.daily entry for postgres backup all
#!/bin/sh
su -l postgres -c /usr/local/sbin/backup_postgres
# a nice comment
@EmmanuelKasper
EmmanuelKasper / backup_vhosts
Last active December 27, 2015 13:38
Simple backup of all Virtual Hosts
#!/bin/sh
[ -d /var/backups/vhosts ] || mkdir /var/backups/vhosts
VHOST_DIR=/srv/www/
cd $VHOST_DIR
for VHOST in *; do
if [ "$VHOST" != "basebox.libera.cc" ]; then
tar cpzf /var/backups/vhosts/$VHOST.tar.gz $VHOST
@EmmanuelKasper
EmmanuelKasper / Puppet Canonical
Last active January 3, 2016 20:59
A canonical puppet deployment file, based on the package / file /service hierarchy
class amanda {
package { "amanda-client":
ensure => installed,
before => File['/etc/amandahosts'],
}
file { "/etc/amandahosts":
ensure => file,
owner => "backup",
group => "backup",
@EmmanuelKasper
EmmanuelKasper / EFI boot on Lenovo Thinkcenter M92Z
Last active February 14, 2023 13:02
EFI boot on Lenovo Thinkcenter M92Z
# disable secure boot in the bios, in menu security
# downlad and unzip refind-bin-0.7.8.zip
# install refind, assuming your ESP partition is /dev/sda1 and mounted in /boot/efi
cd refind-bin-0.7.8
./install.sh
# type y and go ahead
# at that time your boot entry should look like that
#!/bin/bash
#
# =========================================================================
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0