Skip to content

Instantly share code, notes, and snippets.

View cloudnull's full-sized avatar
👨‍🚒
Yup

Kevin Carter cloudnull

👨‍🚒
Yup
View GitHub Profile
@cloudnull
cloudnull / flake.nix
Created April 6, 2024 06:16 — forked from voidus/flake.nix
Build a cloudinit image in nixos
{
description = "A nixos cloudinit base image without nixos-infect";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
};
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
@cloudnull
cloudnull / rke1-openstack.sh
Last active November 24, 2023 21:04
RKE1 OpenStack
alias os='openstack --os-cloud rxt-mvp '
os network create osh1
os subnet create \
osh1-subnet \
--network osh1 \
--subnet-range 172.31.0.0/28 \
--dns-nameserver 8.8.8.8
@cloudnull
cloudnull / ara.bash
Last active March 2, 2023 12:49
Using the ARA CLI Client, return unique hosts where a task is found and in a defined state.
function ara-task-uniq-hosts () {
# Scans across all tasks within 1 million records and returns all of the unique hosts where the task
# meets a certain state. Default state is "ok"
# When looking for the "changed" state the special CLI modifier is used.
TASK_NAME=$1
TASK_STATE=${2:-ok}
if [ ${TASK_STATE} == "changed" ]; then
TASK_MODIFY="--changed"
else
TASK_MODIFY="--status ${TASK_STATE}"
@cloudnull
cloudnull / fig-up.rc
Last active August 4, 2023 15:58
compose omnibus protocol shell
function fig-up () {
function get_latest_release() {
curl $(curl --silent "https://api.github.com/repos/ovrclk/cosmos-omnibus/releases/latest" | jq ".url" -r) | jq -r .tag_name
}
function get_rpc_endpoint() {
curl --silent "https://cdn.jsdelivr.net/gh/cosmos/chain-registry@master/$1/chain.json" | jq ".apis.rpc[0].address" -r
}
if ! command -v jq &> /dev/null; then
@cloudnull
cloudnull / teleport-update-playbook.yml
Created November 10, 2022 14:28
Teleport upgrade playbook
# This playbook is used to upgrade teleport in place, it will deploy the apt repo using facts.
#
# Invocation,
# $ ansible-playbook -i ~/projects/teleport-inventory.py ~/projects/teleport-playbook.yml -e ansible_user=debian --limit '!teleport-server'
#
# NOTE: This playbook book exectuion is using dynamic inventory and a limit which is ensuring that the playbook is not executed against
# the teleport server. The playbook can be used on the teleport server, it just has to be done in isolation; a restart of the server
# will impact client connectivity.
---
- name: Teleport updates
import collections
import json
import re
import sys
GROUPS = dict()
HOSTS = dict()
PROTOS = dict()
R_WORDS = re.compile(r"\w+")
@cloudnull
cloudnull / gist:c17c210f86364ba561b5848bd7d70fe3
Created October 28, 2022 17:15
Installing Nvidia's proprietary drivers from source
cat > /etc/modprobe.d/blacklist-nouveau.conf <<EOF
blacklist nouveau
options nouveau modeset=0
EOF
apt update
apt install -y wget linux-headers-$(uname -r) build-essential libglvnd-dev pkg-config dkms
DOWNLOAD_URL="https://us.download.nvidia.com/XFree86/Linux-x86_64/515.76/NVIDIA-Linux-x86_64-515.76.run"
# Required config
# $ export ANSIBLE_SCP_IF_SSH=False
# $ export ANSIBLE_SSH_ARGS="-F /home/USERNAME/.ssh/teleport.cfg"
# $ export ANSIBLE_INVENTORY_ENABLED=yaml
# $ export ANSIBLE_HOST_KEY_CHECKING=false
---
- hosts: all
gather_facts: true
become: true
@cloudnull
cloudnull / teleport-inventory.py
Last active September 30, 2022 03:07
A simple dynamic Ansible inventory which uses node (server) information from teleport.
#!/usr/bin/env python3
"""Teleport Inventory Documentation.
Very simple inventory script which will use teleport as a dynamic inventory source.
The script assumes you've logged in and have access to the teleport service.
The script will read machines and return JSON information from teleport. Once the
return information is sourced, it will format the inventory using the node name
as the target host and the labels as hostvars and groups.
@cloudnull
cloudnull / openstack-setup.sh
Last active January 4, 2023 18:25
setup commands post openstack deployment
source ~/openrc
pushd /mnt/storage/media/cloud-images
for NAME in $(ls -1 /mnt/storage/media/cloud-images | egrep '\.(img|qcow2)'); do
openstack image create --disk-format qcow2 --container-format bare --public --file /mnt/images/${NAME} ${NAME}; \
openstack image set --property hw_scsi_model=virtio-scsi \
--property hw_disk_bus=scsi \
--property hw_vif_multiqueue_enabled=true \
--property hw_qemu_guest_agent=yes \
--property hypervisor_type=kvm \