Skip to content

Instantly share code, notes, and snippets.

View gonoph's full-sized avatar

Billy Holmes gonoph

View GitHub Profile
@gonoph
gonoph / satellite.yml
Created January 31, 2024 15:45
Satellite registration playbook example
---
# vim: ts=2 sw=2 ai expandtab
- name: Register to Satellite
hosts: "{{ workflow_hosts | default('all') }}"
connection: smart
gather_facts: true
become: true
vars_files:
- satellite_credentials.yml
@gonoph
gonoph / peek.bash
Last active November 8, 2023 16:48
Peek.bash - get a hex dump of the memory of a running process
#!/bin/bash
# vim: sw=4 ts=4 expandtab
# modifed from https://www.baeldung.com/linux/read-process-memory
err() { echo "$@" >&2 ; exit 1; }
test -z "$1" && err "Usage: $0 <pid>"
test -d "/proc/$1" || err "PID $1 does not exist"
while read -r mem_range perms JUNK ; do
if [[ "$perms" == "r"* ]]; then
@gonoph
gonoph / sshtmp.bash
Created October 9, 2023 14:01
sshtmp - quick function to ssh to a machine without remembering the hostkey
# put this in .bashrc
# - or -
# mkdir ~/.bashrc.d
# put it in ~/.bashrc.d/sshtmp.bash
sshtmp ()
{
echo "About to temporarily connect to host" > /dev/tty;
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$@"
}
@gonoph
gonoph / get_ip_tests.bash
Last active April 16, 2024 15:42
Different script methods to obtain the primary interface ip address
###
### Use any of the following to programmatically obtain the primary interface ip address
###
# using ansible facts module
# requires: jq
ansible -msetup -i localhost, all -o | cut -d'>' -f 2- | jq .ansible_facts.ansible_default_ipv4.address | xargs echo
# ip command and bash
# requires: iproute
@gonoph
gonoph / aws-rhel-buildah.sh
Last active September 15, 2018 03:41
container image based on RHEL 7.5 for AWS RHUI Hosts
#!/bin/bash
# This will build a container image based on RHEL 7.5
# for use in AWS with RHUI
DEFAULT_FROM=rhel7/rhel:7.5
DEFAULT_TAG='devel/rhel:latest'
BZ='https://bugzilla.redhat.com/show_bug.cgi?id=1498628'
declare -r DEFAULT_FROM DEFAULT_TAG BZ
@gonoph
gonoph / satellite-randomize-playbook.yml
Created June 1, 2018 03:25
Randomize Satellite Username and Password
# vim: sw=2 ai expandtab
---
- name: Randomize Satellite Username and Password
hosts: satellites
gather_facts: false
connection: smart
become: false
force_handlers: True
@gonoph
gonoph / Password-Generator.md
Created February 2, 2018 08:59
Password generator

Generates a selection of random passwords of the specified length

genpass ()
{
  local _size=$1          # size of the password - default(16)
  local _count=$2         # how many passwords to generate - default(fill your terminal screen)
  local _rc _rows _width _cols

  : ${_size:=16}
@gonoph
gonoph / OpenShift-Kubernetes-Docker-BashFunctions.md
Last active May 3, 2019 14:44
Basic Docker, Kubernetes, and OpenShift commands for management

Helpful commands for management in Docker, Kubernetes, and OpenShift

Clean up old podman images

cleanpodman()
{
    # clean up any containers that have Exited
    for i in $(podman ps -qa);
    do
        # this does it in parallel
@gonoph
gonoph / openshift-cheatsheet.md
Created February 2, 2018 07:53 — forked from rafaeltuelho/openshift-cheatsheet.md
My Openshift Cheatsheet
  • Binary Builds
oc new-build --binary=true --name=ola2 --image-stream=redhat-openjdk18-openshift
oc start-build ola2 --from-file=./target/ola.jar --follow
oc new-app 
  • Turn off/on DC triggers to do a batch of changes without spam many deployments