Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/ruby
#
# Author: Sergio Pena
#
# yum -y install mysql-devel
# gem install mysql
# gem install rest-client
# gem install logger
# gem install xml-simple
@chirauki
chirauki / abipuppet.sh
Last active August 29, 2015 13:57
Abiquo install using puppet
yum -y install rubygems && gem install puppet --no-ri --no-rdoc
mkdir -p /etc/puppet/modules
sed -i '/alias\ mv/d' ~/.bashrc
sed -i '/alias\ rm/d' ~/.bashrc
cd /etc/puppet/modules && curl -L -s --insecure https://github.com/chirauki/abiquo-abiquo/blob/master/pkg/abiquo-abiquo-0.1.0.tar.gz?raw=true -o abiquo-abiquo-0.1.0.tar.gz
mkdir -p /etc/puppet/modules/abiquo && cd /etc/puppet/modules/abiquo && tar --strip-components=1 -xzf ../abiquo-abiquo-0.1.0.tar.gz
cd /etc/puppet/modules/ && rm *.tar.gz
for i in `grep dependency /etc/puppet/modules/abiquo/Modulefile | cut -d"'" -f2`; do [ -d /etc/puppet/modules/`echo $i | cut -d'/' -f2` ] || puppet module install $i ; done
puppet apply -l ~/puppet.log -e "class{ 'abiquo::api': } class{ 'abiquo::client': } class{ 'abiquo::remoteservice': }"
@chirauki
chirauki / abiinstall.sh
Last active August 29, 2015 14:00
Abiquo installation on a CentOS 6 from mothership
#!/bin/bash
if [ -f /usr/bin/puppet ]
then
echo "Puppet agent already installed. Skipping install"
else
yum -y localinstall http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
yum -y install puppet
[ -d /etc/puppet/modules ] || mkdir -p /etc/puppet/modules
cd /etc/puppet/modules && curl -L -s --insecure https://github.com/chirauki/abiquo-abiquo/blob/master/pkg/abiquo-abiquo-0.1.0.tar.gz?raw=true -o abiquo-abiquo-0.1.0.tar.gz
@chirauki
chirauki / lang-mangle.rb
Created July 12, 2016 10:43
Replace words on Abiquo language files
#!/usr/bin/env ruby
require 'trollop'
require 'json'
require 'highline'
@opts = Trollop::options do
opt :unattended, "Do not ask for permission", :type => :boolean
opt :replace, "Replace some word in lang file", :type => :boolean
opt :source, "Word to replace", :type => :string
opt :target, "Replacement word", :type => :string
@chirauki
chirauki / cert.rb
Created September 1, 2016 14:00
cert.rb
# Cookbook Name:: abiquo
# Recipe:: certificate
#
# Copyright 2014, Abiquo
#
# 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
@chirauki
chirauki / dnsruby.rb
Created October 3, 2016 08:35
DNS ruby
rname = 'test.example.com'
key_name = 'challenge-key'
key = 'ECNx9woMslMkzn5t+eR8HBLULUGh7GQ2N9N5RumbzOUKudg=='
update = Dnsruby::Update.new('example.com')
update.absent('foo.example.com.', 'A')
update.add('foo.example.com.', 'A', 86400, '10.1.2.3')
res.tsig=key_name,key
res.send_message(update)
@chirauki
chirauki / readme.md
Last active December 7, 2016 15:37
Deploy VCSA + NSX

Deploy VCSA 6.0

You need the profile json file:

{
    "deployment":
    {
        "esx.hostname":"10.60.1.63",
        "esx.datastore":"ds-ucs-blade-3",
@chirauki
chirauki / apache.md
Created January 17, 2017 13:52
Modify JSON links in response

Modify JSON links in response

This allows, for example, changing the host or path in a HTTP link on a JSON response body.

Enable mod_filter and mod_substitute. Adjust vHost according to Apache version.

Apache 2.2

<VirtualHost *:443>
@chirauki
chirauki / Vagrantfile
Last active March 10, 2017 14:51
Abiquo demo environments with Vagrant
require 'uri'
VAGRANTFILE_API_VERSION = "2"
# Define env name
unless ENV['ENV_NAME']
puts <<EOF
You have to specify an environment name using the ENV_NAME variable.
Eg. ENV_NAME=someenv vagrant up
@chirauki
chirauki / migrate.py
Last active March 29, 2024 15:52
KVM migration script
#!/usr/bin/env python
import logging
import argparse
import libvirt
import sys
import os
import subprocess
import paramiko
import xml.etree.ElementTree as ET
from urlparse import urlparse