Skip to content

Instantly share code, notes, and snippets.

View arbabnazar's full-sized avatar
🏠
Working from home

Arbab Nazar arbabnazar

🏠
Working from home
View GitHub Profile
@arbabnazar
arbabnazar / main.yml
Last active April 9, 2019 20:19 — forked from rothgar/main.yml
Generate /etc/hosts with Ansible
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source.
# Will include all hosts the playbook is run on.
# Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html
- name: "Build hosts file"
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: groups['all']
@arbabnazar
arbabnazar / README.md
Created October 9, 2015 22:56 — forked from simkimsia/README.md
How to setup Ubuntu 14.04 for Python Django

How to setup Ubuntu 14.04 server for Python Django Web App

Assuming you are in root

Make sure the locale is set to UTF-8

locale-gen UTF-8

Create a .bash_profile in the ~/ with the following entries

@arbabnazar
arbabnazar / Vagrantfile
Created November 20, 2015 12:27 — forked from muhammad-ammar/Vagrantfile
Vagrantfile for Django 1.8 devstack
Vagrant.require_version ">= 1.6.5"
unless Vagrant.has_plugin?("vagrant-vbguest")
raise "Please install the vagrant-vbguest plugin by running `vagrant plugin install vagrant-vbguest`"
end
VAGRANTFILE_API_VERSION = "2"
MEMORY = 4096
CPU_COUNT = 2
@arbabnazar
arbabnazar / terraform-2tier-vpc
Created January 13, 2016 11:49 — forked from bluemalkin/terraform-2tier-vpc
Terraform 2 tier VPC with nat
# define some variables
variable "aws_ubuntu_ami" {
default = "ami-972444ad"
}
variable "aws_keypair" {
default = "xxxx"
}
# AWS account details
from jinja2.utils import soft_unicode
'''
USAGE:
- debug:
msg: "{{ ec2.results | get_ec2_info('id') }}"
Some useful ec2 keys:
id
dns_name
@arbabnazar
arbabnazar / gist:8f36938e0adde6feb4f2
Created February 11, 2016 11:30 — forked from garnaat/gist:4111114
Set up simple lifecycle config for a bucket
from boto.s3.lifecycle import Lifecycle, Transition, Rule
import boto
c = boto.connect_s3()
b = c.lookup('mybucket')
t = Transition(days=0, storage_class='GLACIER')
r = Rule('foo rule', 'foo', 'Enabled', 1, t)
l = Lifecycle()
l.append(r)

I just had to set up Jenkins to use GitHub. My notes (to myself, mostly):

Detailed Instructions

For setting up Jenkins to build GitHub projects. This assumes some ability to manage Jenkins, use the command line, set up a utility LDAP account, etc. Please share or improve this Gist as needed.

Install Jenkins Plugins

@arbabnazar
arbabnazar / boto3_hands_on.md
Created March 25, 2016 12:54 — forked from iMilnb/boto3_hands_on.md
Programmatically manipulate AWS resources with boto3 - a quick hands on

boto3 quick hands-on

This documentation aims at being a quick-straight-to-the-point-hands-on AWS resources manipulation with [boto3][0].

First of all, you'll need to install [boto3][0]. Installing it along with [awscli][1] is probably a good idea as

  • [awscli][1] is boto-based
  • [awscli][1] usage is really close to boto's
@arbabnazar
arbabnazar / rename-bulk-files-with-ansible.yml
Created April 2, 2016 10:23
This playbook is used to perform bulk files rename on remote hosts
- hosts: all
gather_facts: no
become: yes
tasks:
- shell: ls /files/*
register: files_to_rename
- copy:
src: "{{ item.1 }}"
dest: "/files/file-{{ item.0 + 1 }}"
provider "aws" {
region = "${var.aws_region}"
}
// Setup your S3 Bucket
resource "aws_s3_bucket" "cdn_bucket" {
bucket = "${var.bucket_name}"
acl = "public-read"
policy = <<POLICY
{