Skip to content

Instantly share code, notes, and snippets.

View matthewcosgrove's full-sized avatar

Matthew Cosgrove matthewcosgrove

View GitHub Profile
#@ load("@ytt:data", "data")
all:
hosts: #@ data.values
vars:
ansible_connection: local
#@ load("@ytt:data", "data")
#@ load("@ytt:template", "template")
#@ def parse(deployment):
#@ key = "{}".format(deployment.ip)
#@ return {key: {"idrac_ip": "{{ inventory_hostname }}","catalog_xml": deployment.catalogXml}}
#@ end
all:
hosts:
@matthewcosgrove
matthewcosgrove / 01_install_steps.sh
Last active February 7, 2021 14:24
Updated for Catalina and mainly for Music Sequencing https://github.com/matthewcosgrove/macos-bootstrap
#!/bin/bash
# STEP 1: Mount bootable USB and clean up disks
# IMPORTANT: Catalina now introduces a different approach to Disks/Volumes: https://eclecticlight.co/2019/12/17/how-clean-re-installs-change-in-catalina/
# Erase everything for a proper clean install and then create a new GUID Partition Apple_APFS volume (equivalent to https://www.youtube.com/watch?v=PqfqcwmHowc&ab_channel=AjudaAqui)
# Can all be done through Disk Utility rather than terminal diskutil. You just need to create at least one volume otherwise the installer will not see the disk
# STEP 2: Install Catalina from bootable USB
# STEP 3: Download this gist from UI of GitHub "Download Zip
@matthewcosgrove
matthewcosgrove / 00FirewallRuleChecks.MD
Last active November 28, 2020 17:07
Network Dependency Checks

Prequisites to run scripts

requires bash v4+, netcat (nc), jq, spruce

#!/usr/bin/env bash
set -ue
export urls=( \
# BOSH release download
https://bosh.io \
# PCF API with metadata for upgrades
https://network.pivotal.io \
# PCF-Pipelines open-source updates
TMPDIR=""¬
TMPDIR=$(mktemp -d -t dynamic_inventory.XXXXXX)
trap 'rm -rf ${TMPDIR}' INT TERM QUIT EXIT
INVENTORY_FILE="${TMPDIR}"/inventory.yml
cat <<EOF > "${INVENTORY_FILE}"
all:
hosts:
${IP_ADDRESS}:
ansible_python_interpreter: /usr/bin/python3
# Custom certs (taht were installed on Ubuntu) being recognised by python. For example ansible-galaxy
export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
# Or also could do
# $ sudo update-ca-certificates --fresh
# $ export SSL_CERT_DIR=/etc/ssl/certs
govc pool.info -json /drinks-dc/host/drinks-cl/Resources/chardonnay | jq -r '.ResourcePools[].Vm[] | join(":")' | xargs govc ls -L
# relative path - not guaranteed to be unique
govc pool.info ${GOVC_RESOURCE_POOL}
# absolute path
govc pool.info /${GOVC_DATACENTER}/host/${GOVC_CLUSTER}/Resources/${GOVC_RESOURCE_POOL}
# relative path
govc datastore.info "${GOVC_DATASTORE}"
jobs:
- name: upload-product
plan:
- aggregate:
- do:
- get: pcf-pipelines-tarball
- task: unpack-tarball
config:
platform: linux
image_resource:
# from: https://github.com/stedolan/jq/issues/2154#issuecomment-653981166
# alternative to Gron
jq -r 'paths as $p | "\($p) = \(getpath($p))"'