Skip to content

Instantly share code, notes, and snippets.

View bgstack15's full-sized avatar

B. Stack bgstack15

View GitHub Profile
@bgstack15
bgstack15 / update_root_pw.yml
Created October 25, 2017 13:29
Ansible playbook that changes root password
---
# File: /etc/ansible/playbooks/prod/update_root_pw.yml
# Authors: bgstack15
# Startdate: 2017-10-24
# Title: Playbook that updates the local root password
# Purpose: Makes it easy to update the root password
# Usage:
# time ansible-playbook /etc/ansible/playbooks/prod/update_root_pw.yml -i /etc/ansible/dc3.inv -l el7test14 -v --ask-vault-pass
# Make file /home/ansible/rootpw.yml with the contents:
# ---
@bgstack15
bgstack15 / convert_to_seq.sh
Created October 11, 2017 20:28
Convert input sets of numbers into numerical sequences
convert_to_seq() {
printf "${@}" | xargs -n1 -d',' | tr '-' ' ' | awk 'NF == 2 { system("/bin/seq "$1" "$2); } NF != 2 { print $1; }' | xargs
}
convert_to_seq "$1"
@bgstack15
bgstack15 / ls-leases
Created April 2, 2017 16:38
list dhcp leases
#!/bin/sh
# 2017-04-02 12:30 quick and dirty ls-leases
# sed combine lines: http://stackoverflow.com/a/7853846/3569534
DEFAULT_LEASE_FILE=/var/lib/dhcpd/dhcpd.leases
leasefile="${DEFAULT_LEASE_FILE}"
#leasefile=/home/bgirton-local/foo