Skip to content

Instantly share code, notes, and snippets.

View maxamillion's full-sized avatar

Adam Miller maxamillion

View GitHub Profile
@maxamillion
maxamillion / ___command
Last active March 27, 2023 15:36
Running rulebook directly with receptor
printf "/home/admiller/src/dev/receptor/test_rulebook.yml:/home/admiller/src/maxible/inventory.ini" | receptorctl --socket /tmp/foo.sock work submit ansible-rulebook --payload -
Receptor configs:
foo.yml
---
- node:
id: foo
- log-level:
level: Debug
@maxamillion
maxamillion / foo.json
Last active October 25, 2022 21:09
fun with slurped json
{
"data":
{
"foobar": "barfoo",
"linux": "isthebest"
}
}
@maxamillion
maxamillion / readarray-example.sh
Created September 23, 2020 15:07
gnu readarray example (works on bash 4.4+, requires new delimiter param for builtin readarray)
#!/bin/bash
# local_clone_destination_dir my_fork_or_repo [upstream_repo]
mkdir -p /tmp/symlinks
symlinks_src_dest=(
"/tmp/foo /tmp/symlinks/foo"
"/tmp/bar /tmp/symlinks/bar"
)
for symlink in "${symlinks_src_dest[@]}"
@maxamillion
maxamillion / gist:da61f47dc23c3a7f81fff0d84e02e97f
Created August 1, 2019 20:40
httpapi can't determine network_os with multiple plays in a playbook
INVENTORY.TXT
[snort]
40.121.40.224
168.62.170.199
[qradar]
#ec2-34-217-52-111.us-west-2.compute.amazonaws.com
13.90.249.151
@maxamillion
maxamillion / gist:679e8950df0bd2cbf564ee9835b62d55
Last active June 12, 2019 03:27
QRadar CE on CentOS 7.6+ Hacks and Workarounds (so far...)
# Hacks to work around the broken installer and incompatible bundled rpms
mkdir /media/cdrom
mount -o loop ~/QRadarCE7_3_1.GA.iso /media/cdrom
mkdir /tmp/qradar-7.6
cp -R /media/cdrom/* /tmp/qradar-7.6
sed -i 's/release 7.5/release 7.6/g' /tmp/qradar-7.6/inc/setup.funcs
cat >/etc/yum/pluginconf.d/priorities.conf <<EOF
[main]
@maxamillion
maxamillion / dnf_prep_transaction.py
Created April 4, 2019 21:32
Prep DNF Transaction (order matters)
#!/usr/bin/python3
import dnf
base = dnf.Base()
base.conf.read()
base.read_all_repos()
#base.init_plugins()
#base.pre_configure_plugins()
#base.configure_plugins()
base.fill_sack()
base.read_comps()
@maxamillion
maxamillion / plugin.out.json
Last active March 18, 2019 15:21
gce.py Script vs gcp_compute.py Plugin
{
"_meta": {
"hostvars": {
"104.196.66.112": {
"cpuPlatform": "Intel Haswell",
"creationTimestamp": "2017-11-02T15:56:44.318-07:00",
"deletionProtection": true,
"disks": [
{
"autoDelete": true,
@maxamillion
maxamillion / fact_template.j2
Created December 19, 2018 15:30
Ansible filtering facts with templates instead of json_query filter
{% set results = {} %}
{% for fact in ansible_facts %}
{% if ansible_facts[fact] is mapping and 'pciid' in ansible_facts[fact] %}
{% set x=results.__setitem__(ansible_facts[fact]['pciid'], ansible_facts[fact]['device']) %}
{% endif %}
{% endfor %}
{{ results|to_json}}
@maxamillion
maxamillion / openshiftv3fedora24.rst
Last active July 28, 2016 18:13
OpenShift v3 Bring Your Own Fedora 24 Hosts

OpenShift v3 Bring Your Own Fedora 24 Hosts

This is meant to be an evolution of the old Bring Your Own Host document that has been retired upstream. The aim is to be a simple step by step guide for setting up a multi host environment

Example inventory we will be working from can be found upstream here.