Skip to content

Instantly share code, notes, and snippets.

Virendra Singh Bhalothia bhalothia

Block or report user

Report or block bhalothia

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View terminate_tagged_instances_after_6_hours.py
from __future__ import print_function
import json
import boto3
from datetime import datetime, timedelta
from dateutil.tz import tzlocal
print('INFO: Loading function')
DRY_RUN = True # Do not shut down instances
@bhalothia
bhalothia / cloudformation-template_vpc-iam.json
Created Jun 7, 2018 — forked from ianblenke/cloudformation-template_vpc-iam.json
AWS CloudFormation Template example for VPC with IAM Instance Profile
View cloudformation-template_vpc-iam.json
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "MyApp VPC",
"Parameters" : {
"Project" : {
"Description" : "Project name to tag resources with",
"Type" : "String",
"MinLength": "1",
"MaxLength": "16",
"AllowedPattern" : "[a-z]*",
View jenkins2.0-setup-docker
# Commands used in Setting up Jenkins 2.0 on Docker
# To create jenkins-test machine
docker-machine create --driver virtualbox jenkins-test
# To check the ip allocated to the jenkins-test machine
docker-machine ip jenkins-test
# To map the ip address to the jenkins-test alias
vi /etc/hosts
View vagrantfile.rb
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "centos6.5_64"
config.vm.network "forwarded_port", guest: 8080, host: 8080
@bhalothia
bhalothia / .gitignore
Created Sep 29, 2015 — forked from octocat/.gitignore
Some common .gitignore configurations
View .gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@bhalothia
bhalothia / README.md
Last active Dec 2, 2015 — forked from bknowles/README.md
multi-knife-howto
View README.md

Overview

Here is an example shared configuration for knife. You can drop this off in your chef-repo/.chef/ directory, and multiple developers can use the same knife configuration to interact with more than one Chef server, or the Opscode platform.

By using Bash functions and environment variables we can change the chef server, which knife is configured to use, on the fly.

NOTE: knife will probably ignore your ~/.chef/knife.rb once you begin using a shared knife.rb in your chef-repo directory.

Preparation

@bhalothia
bhalothia / ansible-playbook.yml
Last active Aug 29, 2015
register variables across plays
View ansible-playbook.yml
- vars:
# Extra vars from Rundeck for partition type
partition: "{{ partition }}"
# For 'nmctl ps' wrapper - Some deployment validation
number_of_tries: 5
sleep_between_tries: 60
hosts: "app-{{ partition }}[0]" # Canary
View gist:21919a7ec0fdce1df623
Jenkins Best Practices
https://en.wikipedia.org/wiki/Continuous_integration<- Read this!
https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Best+Practices
http://www.slideshare.net/andrewbayer/7-habits-of-highly-effective-jenkins-users
Set up version control of job configurations
Keep jobs simple! Don't put a ton of bash in each job. If a job needs to do something complex, put it in a script in GitHub and check it out as needed.
Use templated builders to simplify common tasks
Keep all scripts in version control - avoid running scripts that live on the Jenkins server filesystem
Don't install unnecessary plugins - plugins are often written by third parties and can interact with each other in strange ways
Use LDAP authentication if possible for traceability - avoid anonymous access
View multi_env_knife_config
#
# This is an example of a knife.rb configuration that uses yml and a
# simple env var (CHEF_ENV) to manage multiple hosted Chef environments.
#
# Example usage:
# export CHEF_ENV=evnironment_01
# knife status
#
# Based on: http://blog.blankpad.net/2010/09/28/multiple-knife-environments---the-return/
#
View jenkins_copying_configuration.sh
ORIGINAL_JENKINS_SERVER=
ORIGINAL_SERVER_USER=
NEW_JENKINS_SERVER=
NEW_SERVER_USER=
# ON THE ORIGINAL JENKINS SERVER
ssh $ORIGINAL_SERVER_USER@$ORIGINAL_JENKINS_SERVER
cd /var/lib/jenkins/
for i in `ls jobs`; do echo "jobs/$i/config.xml";done > config.totar
You can’t perform that action at this time.