Skip to content

Instantly share code, notes, and snippets.

View jsumners's full-sized avatar

James Sumners jsumners

View GitHub Profile

Change Well Known Passwords

This is an Ansible playbook for chaning default, well known, or missing passwords on a set of hosts. To use it:

  1. Start a listener: socat tcp4-listen:8000,fork stdout
  2. Run the playbook: ansible-playbook update_password.pb.yml -e 'user=target_user' -e 'passwd=known_pass'

Your listener will receive notifications like:

@jsumners
jsumners / Intro.txt
Created September 21, 2017 20:57
Deal with NICs in Ansible without knowing what udev/systemd will call them
Scenario:
You are building a load balancer wherein you want to bond the interfaces that will be used to serve the traffic.
You're managing this via Ansible. You don't want to have to boot to an OS to see what udev/system will name the
NICs you intend to bond, because that is just stupid. So you decide to work with the MAC addresses. Oops,
the `ansible_facts` don't make that easy.
Solution:
The convoluted trickery published here.
@jsumners
jsumners / ansible_git_via_ports.sh
Last active September 21, 2017 18:21
Install Ansible from GitHub with MacPorts
#!/bin/bash
sudo port install py27-pip pip_select && \
sudo port select --set python python27 && \
sudo port select --set python2 python27 && \
sudo port select --set pip pip27 && \
sudo pip install jmespath && \
sudo pip install git+git://github.com/ansible/[email protected]
// https://tc39.github.io/ecma262/#sec-set-constructor
const MyList = class MyList extends Set {}
MyList.fromArray = function (aray) {
const list = new MyList()
array.forEach((a) => list.add(a)
return list
}
MyList.prototype.has = function (ele) {
@jsumners
jsumners / ntp.conf
Created July 26, 2017 16:12
RHEL7 Ansible task list to fix NTP
# {{ansible_managed}}
{% if 'vmware' in ansible_product_name|lower %}
# Disable panic quit if system is >1000s out of sync because VMware.
tinker panic 0
{% endif %}
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
@jsumners
jsumners / logtransport.service
Created March 9, 2017 17:35
Screw logstash
# {{ansible_managed}}
[Unit]
Description=Pass logs into ElasticSearch
After=network.target
[Service]
Restart=always
RestartSec=10
ExecStart=/bin/socat -T 0.5 -u tcp4-listen:8888,fork,reuseaddr,su=nobody tcp4:127.0.0.1:9200
@jsumners
jsumners / Readme.md
Created November 8, 2016 14:43
Task list query

Synopsis

I need an application to track tasks that I have completed. I do not need it to track tasks that I will complete. Features:

  • [preferred] a menubar application, no dock icon
  • [requirement] allows specifying storage location, i.e. just a file on the file system
  • [preferred] storage format is parseable, e.g. JSON
  • [requirement] records date item was entered
  • [requirement] allows multiple selection of items to be copied into the clipboard as a list
  • [requirement] items older than a certain number of days would be hidden/archived
#!/bin/bash
#
# This script is for generating a random password, setting it for a specified
# user, and sending that password to a remote listener.
WHO=$(whoami)
# target user for password change
USER=jsumners
RECVR="10.0.0.10"
PORT=8000
if [ $WHO != "root" ]; then
@jsumners
jsumners / foo.js
Created October 25, 2016 13:40
jsdoc-to-markdown documenting a factory function that returns an object literal
/**
* @module foo
*/
/**
* Describe initialization
* @param {object} someInnerGlobal A context
* @return {fooFactory}
* @alias init
*/
@jsumners
jsumners / keybase.md
Last active October 17, 2017 18:29
keybase.md

Keybase proof

I hereby claim:

  • I am jsumners on github.
  • I am jsumners (https://keybase.io/jsumners) on keybase.
  • I have a public key whose fingerprint is 7023 E596 B8E3 0C32 B59C BEB3 9F15 17B3 1988 9114

To claim this, I am signing this object: