Skip to content

Instantly share code, notes, and snippets.

View developerinlondon's full-sized avatar
🙂
BizOps

Wizard Supreme of AI and Automation - Nayeem Syed developerinlondon

🙂
BizOps
View GitHub Profile
@developerinlondon
developerinlondon / remove-gpg-user.sh
Created March 12, 2017 14:12 — forked from phunehehe/remove-gpg-user.sh
Git-crypt remove user.
#!/usr/bin/env bash
#
# Script to remove GPG key from git-crypt
#
# It will re-initialize git-crypt for the repository and re-add all keys except
# the one requested for removal.
#
# Note: You still need to change all your secrets to fully protect yourself.
# Removing a user will prevent them from reading future changes but they will
# still have a copy of the data up to the point of their removal.
@developerinlondon
developerinlondon / create-ecr-imagepullsecret.sh
Created June 17, 2016 23:47
Allow Multi-region Kubernetes to ECR Registry
#!/bin/bash
#
# Create a Kubernetes registry secret for an AWS ECR region
# Requires AWS CLI: https://aws.amazon.com/cli/
# Requires kubectl: https://coreos.com/kubernetes/docs/latest/configure-kubectl.html
#
#
# This secret can be used with 'imagePullSecret' for Kubernetes
@developerinlondon
developerinlondon / jenkins.service
Created June 14, 2016 06:00 — forked from karnauskas/jenkins.service
Jenkins service unit file for Systemd
[Unit]
Description=Jenkins
After=network.target
Requires=network.target
[Service]
Type=simple
EnvironmentFile=/etc/sysconfig/jenkins
ExecStart=/usr/bin/java ${JENKINS_JAVA_OPTIONS} -jar /usr/lib/jenkins/jenkins.war --httpPort=${JENKINS_PORT} --httpListenAddress=${JENKINS_LISTEN_ADDRESS} ${JENKINS_ARGS}
Restart=always
@developerinlondon
developerinlondon / check_salt_state.py
Created June 12, 2016 03:42 — forked from djs52/check_salt_state.py
Nagios Salt check which tests the highstate
#!/usr/bin/env python
# Copyright © 2016 Dan Sheridan <dan.sheridan@postman.org.uk>
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
import salt.client
import argparse
import sys
import fnmatch
@developerinlondon
developerinlondon / Rakefile
Created May 27, 2016 21:27 — forked from a2ikm/Rakefile
Rake tasks for Terraform
task :environment do
errors = []
%w(
TF_VAR_dnsimple_email
TF_VAR_dnsimple_token
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION
).each do |name|
errors << name if ENV[name].nil?
@developerinlondon
developerinlondon / how to install ansible
Created April 27, 2016 15:04
steps to install ansible from source
For anyone who finds this and wants to run a version of ansible that is not full of bugs (which are not edge case bugs i might add) here are the steps you should use on ubuntu. This is specific to trusty, but should be usable with other ubuntu versions by replacing the download URL:
# Make sure we are up to date
/usr/bin/apt-get update
# Download working ansible deb package
wget https://launchpad.net/~ansible/+archive/ubuntu/ansible/+build/8129693/+files/ansible_1.9.4-1ppa~trusty_all.deb -O /tmp/ansible.deb
# Manually install deps
apt-get install -y python-support \
@developerinlondon
developerinlondon / PackerPolicy.json
Created February 26, 2016 13:49 — forked from MattSurabian/PackerPolicy.json
Minimum IAM policy required by AWS for Packer to do its thing. https://github.com/mitchellh/packer Permissions are broken out by API functionality and a resource array has been defined with a wild card for each group. For tighter security resource level permissions can be applied per this documentation: http://aws.typepad.com/aws/2013/07/resourc…
{
"Statement": [
{
"Sid": "PackerSecurityGroupAccess",
"Action": [
"ec2:CreateSecurityGroup",
"ec2:DeleteSecurityGroup",
"ec2:DescribeSecurityGroups",
"ec2:AuthorizeSecurityGroupIngress",
"ec2:RevokeSecurityGroupIngress"
class sethostname {
file { "/etc/hostname":
ensure => present,
owner => root,
group => root,
mode => 644,
content => "$::fqdn\n",
notify => Exec["set-hostname"],
}
exec { "set-hostname":
packer build packer.json 2>&1 | sudo tee output.txt
tail -2 output.txt | head -2 | awk 'match($0, /ami-.*/) { print substr($0, RSTART, RLENGTH) }' > sudo ami.txt
- hosts: all
vars:
ec2_access_key: "AKIA-----------A"
ec2_secret_key: "i-------------/--------A"
remote_user: ec2-user
sudo: yes
tasks:
- name: "make sure package perl-switch is installed for the monitoring scripts"
yum: name=perl-Switch state=present
when: ansible_os_family == "RedHat"