Skip to content

Instantly share code, notes, and snippets.

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

Tom Walsh tomwalsh

🏠
Working from home
  • Just to the left of right.
View GitHub Profile
@tomwalsh
tomwalsh / gist:91fe0c5b579c2687f053a1d9447dd2f6
Created October 23, 2023 14:29
Ansible playbook checking for docker.gpg on Ubuntu
- name: Check for the Docker GPG key
stat:
path: /etc/apt/trusted.gpg.d/docker.gpg
register: docker_key
- name: Download the Docker GPG key
get_url:
url: https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg
dest: "/tmp/docker.gpg"
mode: '0777'
@tomwalsh
tomwalsh / setupChroot.sh
Created December 21, 2022 14:44
Ubuntu SCP/SFTP Chroot Helper Script
#!/bin/bash
username="user"
chroot="/path/to/folder/to/chroot"
# create the chrooted directory structure
mkdir $chroot/bin
mkdir $chroot/usr
mkdir $chroot/usr/bin
mkdir $chroot/usr/lib
@tomwalsh
tomwalsh / preseed.cfg
Last active April 21, 2024 22:21
Debian Installer/preseed Partman Setup for RAID and LVM
# Force the system to unmount any previously found file systems
d-i preseed/early_command string umount /media || true
# We are using RAID as our method - This is important
d-i partman-auto/method string raid
# Define which disks we want to use in our RAID configuration
d-i partman-auto/disk string /dev/sda /dev/sdb
# Remove any previous LVM metadata
d-i partman-lvm/device_remove_lvm boolean true
# Remove any previous MD metadata
d-i partman-md/device_remove_md boolean true
@tomwalsh
tomwalsh / rename-indexes.sh
Last active August 2, 2016 19:59
This is a simple script that will run against a local elasticsearch instance and search for one index name and rename it to another index name. rename-indexes.sh oldname newname
#!/bin/bash
for i in `/usr/bin/curl -s 'http://localhost:9200/_cat/indices?v' 2>&1 | grep $1 | awk '{print $3}'`
do
echo "Starting on $i"
NEWFILE=$( echo $i | sed "s/$1-/$2-/")
echo -n "Converting $i to $NEWFILE ..."
STATUSCODE=$(/usr/bin/curl -o /dev/null -s --write-out "%{http_code}" -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d "{\"source\":{\"index\":\"$i\"},\"dest\":{\"index\":\"$NEWFILE\"}}" http://localhost:9200/_reindex )
if test $STATUSCODE -eq 200; then
echo " done."
echo -n "Deleting $i..."
@tomwalsh
tomwalsh / elastic-ip
Last active August 29, 2015 14:26 — forked from therobot/elastic-ip
Elastic IP corosync resource agent
#!/bin/bash
###############################################################################
# CONFIG
# AWS config
# OCF Parameters:
# OCF_RESKEY_aws_secret_key - The AWS secret key for the account with the elastic IP address.
# OCF_RESKEY_aws_access_key - The AWS access key for the account with the elastic IP address.
# OCF_RESKEY_java_home - The base directory for the Java JRE Default: /usr/lib/jvm/java-7-openjdk-amd64/