Skip to content

cloudfoundry-community/misc-bosh-helpers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Miscellaneous BOSH helper scripts

A series of helper scripts to navigate around a maze of BOSH deployment manifests.

Inspired by https://blog.starkandwayne.com/2015/04/02/inspecting-bosh-manifests-in-bash/

Requirements

The latter can be installed with

go get github.com/bronze1man/yaml2json

Installation

cd /usr/local
git clone https://github.com/cloudfoundry-community/misc-bosh-helpers.git

Then add the following to your ~/.bashrc or /etc/bash.bashrc and restart your shell:

export PATH=$PATH:/usr/local/misc-bosh-helpers/bin

manifest_bosh_info

Looks up the director_uuid from the target manifest in your ~/.bosh_config and runs bosh status against the matching BOSH director.

$ manifest_bosh_info test/manifests/cf-bosh-lite.yml

find_manifests

Finds any BOSH deployment manifests within target path and subfolders.

$ find_manifests
./test/manifests/cf-bosh-lite.yml
./test/manifests/cf-monitor-server.yml

$ find_manifests test
./test/manifests/cf-bosh-lite.yml
./test/manifests/cf-monitor-server.yml

find_manifests_for_release

Finds BOSH manifests within target path and subfolders that use specified release name

$ find_manifests_for_release cf
./test/manifests/cf-bosh-lite.yml
./test/manifests/cf-monitor-server.yml

$ find_manifests_for_release monitor-server test/manifests
./test/manifests/cf-monitor-server.yml

$ find_manifests_for_release xxx
<no result>

find_cf_manifest_for_api

Finds CF BOSH manifest for a CF API (-u uri); or show all APIs for all CF manifests.

Show all CF APIs for all CF BOSH manifests:

$ find_cf_manifest_for_api
./test/manifests/cf-bosh-lite.yml https://api.10.244.0.34.xip.io
./test/manifests/cf-monitor-server.yml https://api.10.244.10.34.xip.io

Find a specific CF BOSH manifest for a given API hostname:

$ find_cf_manifest_for_api -u api.10.244.0.34.xip.io
./test/manifests/cf-bosh-lite.yml https://api.10.244.0.34.xip.io
$ find_cf_manifest_for_api -u something.unknown.com
<no result>

NOTE: use awk to extract the filename from each result line:

$ find_cf_manifest_for_api -u api.10.244.0.34.xip.io | awk '{print $1}'
./test/manifests/cf-bosh-lite.yml

Target the discovered BOSH manifest:

$ bosh deployment $(find_cf_manifest_for_api -u api.10.244.0.34.xip.io | awk '{print $1}')
Deployment set to `.../misc-bosh-helpers/test/manifests/cf-bosh-lite.yml'

find_micro_bosh

Find Micro BOSH manifests (like micro_bosh.yml), the parent folder containing bosh-workspace.yml, and the assigned IP for the Micro BOSH:

$ find_micro_bosh
.../aws_vpc/micro_bosh.aws_vpc.yml .../aws_vpc 10.10.3.4
.../openstack_nova/openstack/micro_bosh.openstack.nova_vip.yml .../openstack_nova/openstack 1.2.3.4
.../not-deployed-yet/micro-bosh.yml not-deployed null

If a Micro BOSH YAML file is found but no bosh-deployments.yml is found in the parent folders, then not-deployed is returned as the 2nd item on the result line (see above).

If a Micro BOSH YAML file doesn't yet specify the IP address then null is shown.

To only show micro_bosh.yml that have been deployed at least once:

$ find_micro_bosh | grep -v not-deployed