Skip to content

Instantly share code, notes, and snippets.

@remoteur
remoteur / miq_install
Last active February 23, 2016 17:19
miq_install
sudo yum -y install git-all memcached postgresql-devel postgresql-server libxml2-devel libxslt-devel gcc-c++ gnupg graphviz which graphviz-ruby
sudo systemctl stop firewalld
sudo systemctl disable firewalld
sudo systemctl start memcached
sudo systemctl enable memcached
sudo sh -c "echo postgres:smartvm | chpasswd"
sudo -u postgres initdb -D /var/lib/pgsql/data
sudo systemctl start postgresql
sudo systemctl enable postgresql
sudo -u postgres psql -c "CREATE ROLE root SUPERUSER LOGIN PASSWORD 'smartvm'"
@remoteur
remoteur / db_create
Created March 20, 2015 00:56
db_create
#!/bin/bash
db=$1
pass=$(openssl rand -hex 10)
mysql -e "CREATE DATABASE $1"
mysql -e "GRANT ALL PRIVILEGES ON $db.* TO '$db'@'localhost' IDENTIFIED BY '$pass';"
mysql -e "GRANT ALL PRIVILEGES ON $db.* TO '$db'@'%' IDENTIFIED BY '$pass';"
echo $pass > .$db
@remoteur
remoteur / docker-wordpress
Last active August 29, 2015 14:18
Docker create wordpress instance
#!/bin/bash
WEBNODE_ROOT='/srv/webnode'
DB_ADDRESS=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' db-server)
DB_ROOT_PASSWD=$(docker inspect --format '{{ .Config.Env }}' db-server | awk {'print $1'} | awk -F '=' {'print $2'})
echo "Enter wordress domain: "
read WP_DOMAIN
WP_DOMAIN_PASSWD=$(openssl rand -hex 10)
WP_DOMAIN_NAME=$(echo $WP_DOMAIN | awk -F '.' {'print $1'})
@remoteur
remoteur / ospf.config.j2
Last active August 29, 2015 14:18
OSPF Lab Jinja template
config.j2
{% for iface in item.int %}
interface {{ iface.name }}
no shutdown
ip address {{ iface.address }} {{ iface.netmask }}
{% endfor %}
router ospf 1
{% for iface in item.int %}
{% if iface.ospf == "yes" %}
network {{ iface.address }} 0.0.0.0 area 0
@remoteur
remoteur / ospf.playbook
Created April 6, 2015 11:03
ospf.playbook
---
- hosts: localhost
remote_user: marius
sudo: yes
tasks:
- name: Install Apache
yum: name=httpd state=installed
- name: Start Apache
@remoteur
remoteur / ansible-postfix-mandrill
Created April 6, 2015 11:41
ansible-postfix-mandrill
- hosts: basenodes
tasks:
- name: Installs postfix mail server
apt: pkg=postfix state=installed update_cache=true
notify:
- start postfix
- name: Upload mandril authentication info
copy: src=/opt/files/postfix/mandril_passwd dest=/etc/postfix/mandril_passwd mode=0600
register: mandril
notify:
@remoteur
remoteur / rails_env
Last active February 23, 2016 17:36
rails_env
source $(rvm 2.2.2 do rvm env --path)
gem install bundler -v "~>1.8.4"
bundle install --without qpid:metric_fu
cp config/database.pg.yml config/database.yml
cp certs/v2_key.dev certs/v2_key
bin/rails db:environment:set RAILS_ENV=development
bundle exec rake evm:db:reset
bundle exec rake db:seed
bundle exec rake evm:start
@remoteur
remoteur / bgproute
Created April 18, 2015 16:53
BGP Route
#!/usr/bin/expect
set rs routeserver.sunrise.ch
set expstr RS_AS6730
spawn telnet $rs
set route [lindex $argv 0]
expect -re "$expstr"
send "show ip bgp $route"
send -- "\r"
expect -re "$expstr"
send -- "exit\r"
@remoteur
remoteur / heat-wordpress
Last active August 29, 2015 14:27
heat-wordpress
heat_template_version: 2013-05-23
description: Simple template to deploy a single compute instance
parameters:
image:
type: string
label: Image name or ID
description: Image to be used for compute instance
default: Fedora22
@remoteur
remoteur / OVS ifcfg scripts
Created August 12, 2015 18:54
OVS ifcfg scripts
[root@server-a cloud-user]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
ONBOOT="yes"
TYPE="OVSPort"
DEVICETYPE=ovs
OVS_BRIDGE=br-ex
[root@server-a cloud-user]# cat /etc/sysconfig/network-scripts/ifcfg-br-ex
DEVICE="br-ex"
BOOTPROTO="static"
ONBOOT="yes"