Skip to content

Instantly share code, notes, and snippets.

View mbruzek's full-sized avatar

Matt Bruzek mbruzek

View GitHub Profile

!!!Note: This is an important note. How does it get rendered in Github flavored markdown?

Hello this is a quote block using the > sign.

# The machine constraints for each service in this bundle
# have been commented out so you don't run into quota
# problems on public clouds. Modify and uncomment the
# constraints: lines for each service to reflect your
# deployment before moving to production.
#
series: xenial
applications:
filebeat:
charm: "cs:filebeat-5"
#!/bin/bash
# This script uploads e2e results from a Jenkins run using gcloud.
set -o errexit
set -o xtrace
set -o nounset
set -o pipefail
source logging.sh
@mbruzek
mbruzek / curl_file_to_jenkins.sh
Created August 11, 2017 15:07
A script to kick off a parameterized build for Jenkins
#!/bin/bash
# Send a file to a Jenkins build using curl.
# The first parameter must be the URL of the Jenkins job to build.
# The second parameter must be the local file to send to Jenkins.
url=$1
local_file=$2
# curl $JENKINS_URL/job/$JOB_NAME/build -F file_key=@file_path -F json='{"parameter": [{"name": "param_name", "file": "file_key"}]}'
---
- name: test the instackenv logic
hosts: localhost
vars:
num_controllers: 3
num_storage: 5
vars_prompt:
- name: "instack_url"
prompt: "What is th instackenv url?"
private: false
@mbruzek
mbruzek / openstack_ironic_clean.sh
Created July 6, 2018 18:48
The instructions to clean OpenShift nodes between deploys
for ironic_id in $(ironic node-list | awk {'print $2'} | grep -v UUID | egrep -v '^$'); do
ironic node-set-provision-state $ironic_id manage;
done
# Check ironic node-list for managemable
for ironic_id in $(ironic node-list | awk {'print $2'} | grep -v UUID | egrep -v '^$'); do
openstack baremetal node clean $ironic_id --clean-steps '[{"interface": "deploy", "step": "erase_devices_metadata"}]';
done
# watch ironic node list until all cleaned
---
- name: mbruzek test
hosts: localhost
vars:
glusterfs_nodes:
- cns-1.scale-ci.example.com
- cns-2.scale-ci.example.com
- cns-0.scale-ci.example.com
l_glusterfs_count: "{{ glusterfs_count | default(glusterfs_nodes | count) }}"
tasks:
@mbruzek
mbruzek / pty_ssh.py
Created February 4, 2020 15:54
Automating an un-automatable network switch required some creative programming. Create an SSH session inside a pseudo terminal (pty), then read and write the file descriptor.
#!/usr/bin/python3
import argparse
import getpass
import os
import pty
import re
import sys
import time
@mbruzek
mbruzek / sparsify_method1.sh
Last active April 7, 2020 22:15
Sparsify a qemu disk with backing file.
#!/bin/bash
# Implement method 1 to compress the VM differencing disks.
LIBVIRT_IMAGES=/var/lib/libvirt/images
TARGET_DOMAIN=${1}
function sparsify {
local TARGET_DISK=${1}
# Print the size of the differencing disk.
hosts.ini
[ios]
sg250a ansible_host=192.168.1.254
[ios:vars]
ansible_become=yes
ansible_become_method=enable
ansible_connection=ansible.netcommon.network_cli
ansible_network_os=cisco.ios.ios