Pivotal/Cloud Foundry/OpsManager
From r00tedvw.com wiki
(Difference between revisions)
Line 22: | Line 22: | ||
Get your pivnet legacy token from here: [https://login.run.pivotal.io/login https://login.run.pivotal.io/login]<br \> | Get your pivnet legacy token from here: [https://login.run.pivotal.io/login https://login.run.pivotal.io/login]<br \> | ||
Click Username > Edit Profile > Look for LEGACY API TOKEN [DEPRECATED] > copy token.<br \> | Click Username > Edit Profile > Look for LEGACY API TOKEN [DEPRECATED] > copy token.<br \> | ||
− | < | + | Apply the API token and test the pivnet CLI |
+ | <nowiki>~$ pivnet login --api-token=h9482hd929dh2998hg | ||
+ | ~$ pivnet products</nowiki> | ||
==Setup alias or token variable== | ==Setup alias or token variable== |
Revision as of 15:54, 27 August 2018
Cloud Foundry | Cloud Foundry CLI | Apps | Tasks | Logs | OpsManager
Contents |
install packages via cli with om tools
install om-tools
Start by installing om-tools, a cli tool for interacting with pivnet. Download the latest release from github (https://github.com/pivotal-cf/om/)
~$ wget https://github.com/pivotal-cf/om/releases/download/0.39.0/om-linux ~$ chmod +x ~/om-linux ~$ ln -s ~/om-linux /usr/local/bin/om ~$ source ~/.bash_profile ~$ om -version
install pivnet cli
Next we need to install the pivnet cli. Download the latest release from github (https://github.com/pivotal-cf/pivnet-cli/)
~$ wget https://github.com/pivotal-cf/pivnet-cli/releases/download/v0.0.53/pivnet-darwin-amd64-0.0.53 ~$ chmod +x ~/pivnet-darwin-amd64-0.0.53 ~$ ln -s ~/Git/pivnet-cli/pivnet-darwin-amd64-0.0.53 /usr/local/bin/pivnet ~$ source ~/.bash_profile ~$ pivnet -version
get pivnet token
Get your pivnet legacy token from here: https://login.run.pivotal.io/login
Click Username > Edit Profile > Look for LEGACY API TOKEN [DEPRECATED] > copy token.
Apply the API token and test the pivnet CLI
~$ pivnet login --api-token=h9482hd929dh2998hg ~$ pivnet products
Setup alias or token variable
Depending on how you want to communicate through om, you can either use a username/password combo or a token from ops manager.
Username/Password
alias oml="om -k -t https://opsmgr-10.haas-59.pez.pivotal.io -u admin -p password"
quick reference
query opsmanager api and print pretty json
~$ testjson=$(curl "https://opsmgr-15.haas-59.pez.pivotal.io/api/v0/stemcell_assignments" --insecure \ -X GET \ -H "Authorization: Bearer $access_token") | echo $testjson | python -m json.tool | more % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0{ "products": [ { "available_stemcell_versions": [ "3468.51" ], "deployed_stemcell_version": "3468.51", "guid": "p-rabbitmq-49407616425a3f96dd5b", "identifier": "p-rabbitmq", "is_staged_for_deletion": false, "label": "RabbitMQ", "product_version": "1.12.7", "required_stemcell_os": "ubuntu-trusty", "required_stemcell_version": "3468.51", "staged_stemcell_version": "3468.51" }, { "available_stemcell_versions": [ "3541.37" ], "deployed_stemcell_version": "3541.37", "guid": "pivotal-mysql-f1cb955f294464dfaffd", "identifier": "pivotal-mysql", "is_staged_for_deletion": false, "label": "MySQL for Pivotal Cloud Foundry v2", "product_version": "2.3.1-build.11", "required_stemcell_os": "ubuntu-trusty", "required_stemcell_version": "3541.34", "staged_stemcell_version": "3541.37" }, { "available_stemcell_versions": [ "3541.37" ], "deployed_stemcell_version": "3541.37", "guid": "p-bosh-404ef12b578f0da0977e", "identifier": "p-bosh", "is_staged_for_deletion": false, "label": "BOSH Director", "product_version": "2.1-build.348", "required_stemcell_os": "ubuntu-trusty", "required_stemcell_version": "3541.37", "staged_stemcell_version": "3541.37" }, { "available_stemcell_versions": [ "3541.37" ], "deployed_stemcell_version": "3541.37", "guid": "cf-5a3f75999090a1afbfdb", "identifier": "cf", "is_staged_for_deletion": false, "label": "Pivotal Application Service", "product_version": "2.1.10", "required_stemcell_os": "ubuntu-trusty", "required_stemcell_version": "3541.36", "staged_stemcell_version": "3541.37" }, { "available_stemcell_versions": [ "3468.51" ], "deployed_stemcell_version": "3468.51", "guid": "p-spring-cloud-services-a033fcb589ee1a7435fa", "identifier": "p-spring-cloud-services", "is_staged_for_deletion": false, "label": "Spring Cloud Services", "product_version": "1.5.6", "required_stemcell_os": "ubuntu-trusty", "required_stemcell_version": "3468", "staged_stemcell_version": "3468.51" } ], "stemcell_library": [ { "hypervisor": "esxi", "infrastructure": "vsphere", "light": false, "os": "ubuntu-trusty", "version": "3468.51" }, { "hypervisor": "esxi", "infrastructure": "vsphere", "light": false, "os": "ubuntu-trusty", "version": "3541.37" } ] } 100 2020 0 2020 0 0 1020 0 --:--:-- 0:00:01 --:--:-- 1020