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/
- bash 3.2+
- golang - install
- BOSH CLI
- jq - http://stedolan.github.io/jq/
- yaml2json - https://github.com/bronze1man/yaml2json
The latter can be installed with
go get github.com/bronze1man/yaml2json
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
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
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
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>
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 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