Skip to content

Instantly share code, notes, and snippets.

View carsongee's full-sized avatar

Carson Gee carsongee

View GitHub Profile
@carsongee
carsongee / openssl-fix.yml
Last active July 5, 2017 02:23
Heartbeat / Heartbleed SSL Ansible check and correct play for Ubuntu
---
# Patches openssl problem and restarts needed services
- name: Apply common configration to all nodes
hosts: all
sudo: yes
# Uncomment to apply update one server at a time
# serial: 1
tasks:
- name: "Install packages and update cache"
@carsongee
carsongee / site.yml
Last active September 26, 2016 05:55
MITx Site Playbook
- name: Apply common configration to all nodes
hosts: all:&tag_org_mitx:&tag_status_production:&tag_env_{{ env }}
sudo: yes
vars_files:
- $playbook_dir/environments/{{ env }}.yml
roles:
- mitx-common
- name: Apply backup configuration
hosts: tag_group_backup:&tag_org_mitx:&tag_status_production:&tag_env_{{ env }}
@carsongee
carsongee / os_provision.yml
Last active August 29, 2015 14:01
OpenStack Network Playbook
# Creates Networks, subnets, security groups, etc.
- name: Create networks
hosts: localhost
gather_facts: False
pre_tasks:
- include_vars: "{{ playbook_dir }}/environments/{{ env }}.yml"
- name: Create network
local_action:
module: quantum_network
auth_url: "{{ os_auth_url }}"
import os
import yaml
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Setup variables for loading yaml settings
CONFIG_DEFAULT = os.path.abspath(os.path.join(BASE_DIR, '../etc'))
CONFIG_ROOT = os.environ.get('CONFIG_ROOT', CONFIG_DEFAULT)
@carsongee
carsongee / private.py
Last active August 29, 2015 14:03
private.py for developing on devstack
from .devstack import * # pylint: disable=wildcard-import, unused-wildcard-import
from .common import INSTALLED_APPS, MIDDLEWARE_CLASSES
FEATURES['ENABLE_SYSADMIN_DASHBOARD'] = True
MODULESTORE = {
'default': {
'ENGINE': 'xmodule.modulestore.mongo.MongoModuleStore',
'OPTIONS': {
"collection": "modulestore",
- name: Apply Upgrade for bash vulnerability in Ubuntu
hosts: all
sudo: yes
tasks:
- name: Check if we are vulnerable
shell: executable=/bin/bash chdir=/tmp foo='() { echo vulnerable; }' bash -c foo
register: test_vuln
ignore_errors: yes
@carsongee
carsongee / test_dns.sh
Created October 2, 2014 15:12
DNS Resolution Check
#!/bin/bash
hostname=example.com
while true; do
ip=$(dig +short $hostname | tail -n 1)
if [ ! -n "$ip" ]; then
echo "Failed at $(date)"
fi
sleep 1
@carsongee
carsongee / .screenrc
Created October 8, 2014 13:49
.screenrc
# no startup msg
startup_message off
# always use a login shell
shell -$SHELL
# auto-log
logfile $HOME/log/screen-logs/%Y%m%d-%n.log
deflog on
escape ^Oo
@carsongee
carsongee / tail_jenkins.py
Last active February 15, 2021 14:04
Tail Jenkins Jobs
#!/usr/bin/env python
"""
Tail a Jenkins build in a terminal
"""
import os
import requests
import sys
import time
@carsongee
carsongee / course_git_backup.sh
Created January 20, 2015 14:50
course backup to git script for edx-platform
#!/bin/bash
# This script assumes that the git repository is already cloned
# App specifics
EDXAPP_USER="edxapp"
EDXAPP_VENV="/edx/app/edxapp/venvs/edxapp"
EDXAPP_DIR="/edx/app/edxapp/edx-platform"
# Git specifics
export GIT_KEY="/edx/app/course_git_backup/git_backup_deploy"