Skip to content

Instantly share code, notes, and snippets.

View samdoran's full-sized avatar

Sam Doran samdoran

View GitHub Profile
@samdoran
samdoran / grub.cfg
Created July 31, 2014 05:06
Grub 2 USB Drive
# Original grub.cfg and instructions from Lance at Pendrivelinux
# http://www.pendrivelinux.com/install-grub2-on-usb-from-ubuntu-linux/
#set timeout=0
set default=0
set isopath="/iso"
menuentry "Ubuntu 12 64-bit" {
set isofile="$isopath/ubuntu-12.iso"
set gfxpayload=keep
@samdoran
samdoran / shellshock-osx.yml
Created October 2, 2014 19:36
Update Bash on OS X
# All three packages must be located next to this playbook. Download them first:
# Mountain Lion: http://support.apple.com/kb/DL1768
# Lion: http://support.apple.com/kb/DL1767
# Mavericks: http://support.apple.com/kb/DL1769?viewlocale=en_US&locale=en_US
---
- hosts: osx
sudo: yes
vars:
@samdoran
samdoran / boxsync-darkmode.pl
Created January 14, 2015 17:33
Change the Box Sync menu bar icons so they look good in Dark Mode on Yosemite
#!/usr/bin/perl
#
# Fix Box Sync menu bar icons so they look good in Dark Mode
# use strict;
use warnings;
use File::Copy;
# --- Variables --- #
my $app_dir = "/Applications";
@samdoran
samdoran / change-root-pword.sh
Created April 4, 2013 15:34
Change root password on many machines via SSH
#!/bin/bash
#
# SSH into hosts listed in /root/Documents/machines and change root password
# Create list of hosts not online in /tmp/offline-hosts
# Assumes direct root login is available on remote machines
# Works bes if SSH keys are setup to allow passwordless login of root
# --- Variables --- #
@samdoran
samdoran / empty-snapshots.sh
Created April 9, 2013 14:25
Make empty month folders for testing snapshot cleanup.
#!/bin/bash
#
# Make empty month folders for testing backup cleanup
# --- Variables --- #
OS=$(uname -s)
HOST=$(hostname)
DESTINATION="./Backup/$HOST"
@samdoran
samdoran / tc-backup.sh
Last active December 18, 2015 08:09
Backup files on a Time Capsule to the local machine using rsnapshot.
#!/bin/bash
#
# Backup files on Time Capsule excluding sparseimages
# Needs to be passed [hourly] [daily] [weekly] [monthly]
# --- Variables --- #
# See if the Time Capsule (TC) is currently mounted.
@samdoran
samdoran / Examples
Last active September 2, 2016 15:40
pasteboard
# Patch files from command line
$ cd ~/ansible-playbooks/playbooks/
$ ansible-playbook -i ~/temp_patches patch_things.yml -e 'target_hosts=all'
# Load ad-hoc inventory patches into Ansible Tower
$ tower-manage inventory_import --source patch_hosts --inventory-name Patches --overwrite --overwrite-vars
===========
# Playbook
- name: Patch all the things
sdoran@sdoran-OSX ~/P/A/P/playbooks (master) [1]> ansible --version
ansible 2.2.0.0
config file = /Users/sdoran/.ansible.cfg
configured module search path = Default w/o overrides
-----------------------
sdoran@sdoran-OSX ~/P/A/P/playbooks (master) [2]> ansible-playbook -i inventory/home vyos.yml -vvv
Using /Users/sdoran/.ansible.cfg as config file
@samdoran
samdoran / cloudforms.py
Created May 31, 2017 16:28
Cloudforms Dynamic inventory with filtering
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
#
# Copyright (C) 2016 Guido Günther <agx@sigxcpu.org>
#
# This script is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@samdoran
samdoran / hosts
Last active June 19, 2017 22:29
Test fact delegation
[lab]
lab-1 ansible_host=10.77.1.11
lab-2 ansible_host=10.77.2.11
lab-3 ansible_host=10.77.3.11