Pivotal/BOSH/CLI

From r00tedvw.com wiki
Revision as of 11:12, 27 August 2018 by R00t (Talk | contribs)

Jump to: navigation, search

BOSH | BOSH CLI | Quick Reference

Contents

CLI Quick Reference

https://bosh.io/docs/cli-v2/

bosh create-env

creates a bosh environment with the director
bosh create-env <path to bosh.yml> \
--state <path to state.json> \
-o <path to cpi.yml> \
-o <path to outbound-network.yml> \
-o <path to bosh-lite.yml> \
-o <path to bosh-lite-runc.yml> \
-o <path to jumpbox-user.yml> \
--var-store <path to creds.yml> \
-v director_name="<bosh director name> \
-v internal_ip=<internal ip for bosh director> \
-v internal_gw=<internal ip for gateway> \
-v internal_cidr=<internal cidr range for network> \
-v outbound_network_name=<name for outbound nat network>
~$ bosh create-env ~/Git/workspace/bosh-deployment/bosh.yml \
  --state ./state.json \
  -o ~/Git/workspace/bosh-deployment/virtualbox/cpi.yml \
  -o ~/Git/workspace/bosh-deployment/virtualbox/outbound-network.yml \
  -o ~/Git/workspace/bosh-deployment/bosh-lite.yml \
  -o ~/Git/workspace/bosh-deployment/bosh-lite-runc.yml \
  -o ~/Git/workspace/bosh-deployment/uaa.yml \
  -o ~/Git/workspace/bosh-deployment/credhub.yml \
  -o ~/Git/workspace/bosh-deployment/jumpbox-user.yml \
  --vars-store ./creds.yml \
  -v director_name=bosh-lite \
  -v internal_ip=192.168.50.6 \
  -v internal_gw=192.168.50.1 \
  -v internal_cidr=192.168.50.0/24 \
  -v outbound_network_name=NatNetwork

bosh env

shows your current environment details
bosh -e <environment alias> env
~$ bosh -e vbox env
Using environment '192.168.50.6' as client 'admin'

Name      bosh-lite
UUID      f2d2eb92-5866-4c5d-8822-7c09ff0f5fc0
Version   266.4.0 (00000000)
CPI       warden_cpi
Features  compiled_package_cache: disabled
          config_server: enabled
          dns: disabled
          snapshots: disabled
User      admin

Succeeded

bosh alias-env

sets up an alias name for the environment
bosh alias-env vbox -e <director ip> --ca-cert <(bosh int ./creds.yml --path /director_ssl/ca)
~$ bosh alias-env vbox -e 192.168.50.6 --ca-cert <(bosh int ./creds.yml --path /director_ssl/ca)
~$ export BOSH_CLIENT=admin
~$ export BOSH_CLIENT_SECRET=`bosh int ./creds.yml --path /admin_password`
sets up an alias name for the environment from ops man director on vsphere. You may need to ssh into the ops manager first.
bosh2 alias-env MY-ENV -e DIRECTOR-IP-ADDRESS --ca-cert /var/tempest/workspaces/default/root_ca_certificate
~$ bosh2 alias-env myenv -e 10.193.81.11 --ca-cert /var/tempest/workspaces/default/root_ca_certificate

Note: you may get an error about an invalid token if you do not log in first.

bosh environments

shows all the available environments
bosh environments
~$ ubuntu@opsmanager-2-2:~$ bosh environments
URL           Alias
10.193.81.11  env

1 environments

Succeeded

bosh log-in

log in to the director. alias is l
bosh -e <env alias> log-in
~$ bosh -e my-env l
User (): admin
Password ():

NOTE: you can set the username and password as environment variables to avoid typing them in:

~$ export BOSH_CLIENT=admin
~$ export BOSH_CLIENT_SECRET=`bosh int ./creds.yml --path /admin_password`


for bosh cli, use the director credentials found in the bosh director tile


bosh log-out

log out of the director
bosh -e <env alias> log-out
~$bosh -e vbox log-out
Logged out from '192.168.50.6'

Succeeded

bosh vms

List all the virtual machines create and managed by BOSH
bosh -e env vms
~$ bosh -e myenv vms

bosh deployments

List all of the deployments managed by BOSH
bosh -e env deployments
~$ bosh -e myenv deployments

bosh -d

specify specific deployment and then specify a command
bosh -e env -d <deployment name> <command>
~$ bosh -e myenv -d cf-3dc74d032cbc62c7fd76 errands

bosh errands

https://bosh.io/docs/errands/

look up errands for a deployment
~$ bosh -e <env alias> -d <deployment id> errands
~$ bosh -e env -d p-rabbitmq-06916615265e9d7a8aaa errands
Using environment '10.193.81.11' as user 'admin' (bosh.*.read, openid, bosh.*.admin, bosh.read, bosh.admin)

Using deployment 'p-rabbitmq-06916615265e9d7a8aaa'

Name
broker-deregistrar
broker-registrar
delete-all-service-instances
deregister-broker
on-demand-broker-smoke-tests
register-broker
smoke-tests
upgrade-all-service-instances

8 errands

Succeeded

bosh run errand

Periodically you may need to manually run an errand to troubleshoot installation problems.
bosh -e <env alias> -d <deployment id> run-errand <errand name>
~$ bosh -e env -d p-rabbitmq-06916615265e9d7a8aaa run-errand smoke-tests
Using environment '10.193.81.11' as user 'admin' (bosh.*.read, openid, bosh.*.admin, bosh.read, bosh.admin)

Using deployment 'p-rabbitmq-06916615265e9d7a8aaa'

bosh stemcells

list stemcells uploaded into the director
bosh -e <env alias> stemcells
~$ ubuntu@opsmanager-2-2:~$ bosh -e env stemcells
Using environment '10.193.81.11' as user 'director' (bosh.*.read, openid, bosh.*.admin, bosh.read, bosh.admin)

Name                                      Version   OS             CPI                   CID
bosh-vsphere-esxi-ubuntu-trusty-go_agent  3586.24*  ubuntu-trusty  d074a48b3f1b0a04ef9a  sc-04bc7c66-bc1f-44db-9926-980883e2deea
~                                         3541.34*  ubuntu-trusty  d074a48b3f1b0a04ef9a  sc-90dfd49a-4ec9-42a9-a3b0-ca9fc0ca611e
~                                         3468.51*  ubuntu-trusty  d074a48b3f1b0a04ef9a  sc-b97ed53b-2115-4aee-904e-f248b7c95205
~                                         3445.48*  ubuntu-trusty  d074a48b3f1b0a04ef9a  sc-fcc00e08-d846-44de-bca6-db95e25e27e5

(*) Currently deployed

4 stemcells

Succeeded

bosh upload-stemcell

Uploads stemcell to the director. succeeds even if the stemcell is already imported.
bosh -e env upload-stemcell <location, local or http> [--fix]
~$

bosh vitals

Allows you to see the vitals of vms within a deployment. provides alot of great output.
bosh -e <env alias> -d <deployment id> vms --vitals
~$ ubuntu@opsmanager-2-2:~$ bosh -e env -d apm-99d751ebfe1e2111535f vms --vitals
Using environment '10.193.81.11' as user 'admin' (bosh.*.read, openid, bosh.*.admin, bosh.read, bosh.admin)

Task 6346. Done

Deployment 'apm-99d751ebfe1e2111535f'

Instance                                                   Process State  AZ   IPs           VM CID                                   VM Type  Active  VM Created At                 Uptime  Load              CPU    CPU   CPU   CPU   Memory        Swap         System      Ephemeral   Persistent
                                                                                                                                                                                             (1m, 5m, 15m)     Total  User  Sys   Wait  Usage         Usage        Disk Usage  Disk Usage  Disk Usage
elasticsearch_data/4c76547b-0b73-4933-97ec-4b33a602a320    running        az1  10.193.81.73  vm-1c93762a-dd97-4776-867d-3cfe523b1541  xlarge   true    Thu Jul 12 21:06:21 UTC 2018  -       0.00, 0.03, 0.05  -      0.1%  0.1%  0.0%  6% (1.0 GB)   0% (0 B)     37% (30i%)  2% (0i%)    0% (0i%)
elasticsearch_data/7ea1bab3-13b1-4a6c-92d3-8626abfdf4f9    running        az1  10.193.81.72  vm-5824480e-e18f-418b-8bd8-a5e98d9fbd5f  xlarge   true    Thu Jul 12 21:06:27 UTC 2018  -       0.00, 0.01, 0.00  -      0.2%  0.3%  0.1%  6% (1.0 GB)   0% (0 B)     37% (30i%)  2% (0i%)    0% (0i%)
elasticsearch_data/b2cf575b-39d4-4947-a4d9-4847fd46bbc7    running        az1  10.193.81.74  vm-5649acd1-137b-4bfc-8856-6ba4dfacc239  xlarge   true    Thu Jul 12 21:06:26 UTC 2018  -       0.00, 0.03, 0.00  -      0.2%  0.2%  0.0%  7% (1.1 GB)   0% (0 B)     37% (30i%)  2% (0i%)    0% (0i%)
elasticsearch_data/fa11168a-4832-4df9-9117-2c83c029b5f0    running        az1  10.193.81.75  vm-4dcfd67d-93bc-4b9f-b3c6-816d36a061b8  xlarge   true    Thu Jul 12 21:06:28 UTC 2018  -       0.00, 0.01, 0.00  -      0.3%  0.1%  0.0%  6% (1.0 GB)   0% (0 B)     37% (30i%)  2% (0i%)    0% (0i%)
elasticsearch_master/b4cfd5f5-cece-414f-b2a5-f9f25139205e  running        az1  10.193.81.71  vm-d0febafe-1521-4329-a40a-949b18c7befe  large    true    Thu Jul 12 21:06:12 UTC 2018  -       0.00, 0.00, 0.00  -      0.2%  0.1%  0.0%  6% (522 MB)   0% (0 B)     37% (30i%)  4% (0i%)    0% (0i%)
mysql/1e4a4316-ae06-4553-a6b4-94181d72110b                 running        az1  10.193.81.77  vm-ed7cebae-7e96-461e-87c0-faa425364a83  xlarge   true    Thu Jul 12 21:06:24 UTC 2018  -       1.01, 1.01, 1.00  -      0.2%  0.1%  0.3%  17% (2.8 GB)  0% (1.7 MB)  37% (30i%)  8% (1i%)    1% (0i%)
redis/32b5861d-b94e-4a68-9247-edb704dc22d6                 running        az1  10.193.81.76  vm-1f8a702c-db64-491d-91d0-9e46f04f6fe7  medium   true    Thu Jul 12 21:06:25 UTC 2018  -       0.02, 0.03, 0.00  -      0.4%  0.4%  0.1%  3% (106 MB)   0% (0 B)     37% (30i%)  4% (0i%)    0% (0i%)
Personal tools
Namespaces

Variants
Actions
Navigation
Mediawiki
Confluence
DevOps Tools
Open Source Products
Ubuntu
Ubuntu 22
Mac OSX
Oracle Linux
AWS
Windows
OpenVPN
Grafana
InfluxDB2
TrueNas
OwnCloud
Pivotal
osTicket
OTRS
phpBB
WordPress
VmWare ESXI 5.1
Crypto currencies
HTML
CSS
Python
Java Script
PHP
Raspberry Pi
Canvas LMS
Kaltura Media Server
Plex Media Server
MetaSploit
Zoneminder
ShinobiCE
Photoshop CS2
Fortinet
Uploaded
Certifications
General Info
Games
Meal Plans
NC Statutes
2020 Election
Volkswagen
Covid
NCDMV
Toolbox