Skip to content

Instantly share code, notes, and snippets.

@cocoy
cocoy / example.tf
Last active February 14, 2018 10:53
### NOTE:
### You need to input your ACCESS_KEY, SECRET_KEY, KEYPAIR_NAME, VPC_ID
###
provider "aws" {
access_key = "YOUR_ACCESS_KEY"
secret_key = "YOUR_SECRET_KEY"
region = "us-west-2"
}
## Instance Declaration
#!/bin/bash
##
# Compiling terraform-provisioner-ansible for Terraform 0.7.13 for Ubuntu Trusty
#
# $ mkdir terraform-trusty64
# $ cd terraform-trusty64/
# $ vagrant init ubuntu/trusty64
# $ vagrant up
# $ vagrant ssh
@cocoy
cocoy / gist:b9e63d871c3a711e153e
Created April 8, 2015 14:04
lxc web panel centos init script
#!/bin/sh
# chkconfig: 2345 20 80
# description: LXC Web Panel
### BEGIN INIT INFO
# Provides:
# Required-Start:
# Required-Stop:
# Should-Start:
@cocoy
cocoy / check_redis.py
Created January 30, 2013 09:18
Modified a bit.
#!/usr/bin/env python
"""
check_redis.py: Nagios plugin for checking a redis server.
Author: Steffen Zieger <me@saz.sh>
License: GPL
Version: 1.0
"""
@cocoy
cocoy / group_by_register
Created December 5, 2012 09:00
ansible group_by example using register
- hosts: all
tasks:
#- name: Create a group of all hosts by operating system
# action: group_by key=${ansible_distribution}-${ansible_distribution_version}
#- name: Create a group of all hosts by operating system
# action: group_by key=${ansible_distribution}-${ansible_distribution_version}
@cocoy
cocoy / nagios_nginx
Created November 28, 2012 09:03
nagios_nginx config
server {
server_name localhost;
listen 80;
auth_basic "Restricted Area";
auth_basic_user_file /etc/nagios3/htpasswd.users;
root /usr/share/nagios3/htdocs;
index index.php index.html;
@cocoy
cocoy / gist:4085334
Created November 16, 2012 08:05
check processes eating memory.
ps -A --sort -rss -o comm,pmem | head -n 11
location /v1/ {
rewrite /v1/(.+) /$1 permanent;
proxy_set_header Host $host;
proxy_set_header X-Request-URL $scheme://$http_host$request_uri;
proxy_pass http://public-api-backend;
}
location /v1/ {
proxy_set_header Host $host;
@cocoy
cocoy / gist:3523338
Created August 30, 2012 06:34
rsyslog to logstash nginx access log
$InputFileName /var/log/nginx/access.log
$InputFileTag nginx-acess:
$InputFileStateFile stat-nginx-access
$InputFileSeverity info
$InputRunFileMonitor
@cocoy
cocoy / ansible-pull-test
Created May 17, 2012 14:53
testing ansible-pull
#!/bin/bash -ex
# install needed packages for ansible
apt-get install -y -q python-paramiko python-yaml python-jinja2 python-simplejson
apt-get install -y -q git-core
# get ansible -- :)
git clone git://github.com/ansible/ansible.git
cd ./ansible