This repository contains scripts to order/list/retire services from CloudForms using the CloudForms API.
# export credentials
export username=username-domain.com
export password=yourpassword
export uri=https://labs.opentlc.com
# order 5 service items 'OCP HA Lab - Testing' from catalog 'DevOps Deployment Testing' in North America
./order_svc.sh -t 5 -y \
-c 'DevOps Deployment Testing' \
-d region=na \
-i 'OCP HA Lab - Testing'
# order 2 x OCP HA Lab (PROD) in APAC datacenter
./order_svc.sh -t 2 -y \
-d region=apac \
-c 'OPENTLC OpenShift Labs' \
-i 'OpenShift HA Lab'
# order 45 x OCP HA Lab (PROD), wait 20 seconds between api calls, group by 5, pause 5 minutes between groups.
./order_svc.sh -t 45 -a 20 -g 5 -p 5 -y \
-d region=na \
-c 'OPENTLC OpenShift Labs' \
-i 'OpenShift HA Lab'
[user@work cloudforms-oob]$ ./get_svc.sh 20000000059300 OTLC-ADM-gucore-redhat.com-DEV_THREE_TIER_APP-f3b8 20000000059304 OTLC-ADM-gucore-redhat.com-DEV_OCP_WORKSHOP-c53b 20000000059302 OTLC-ADM-gucore-redhat.com-DEV_OCP_DEMO_LAB-1909 20000000059301 OTLC-ADM-gucore-redhat.com-DEV_ANS_TOWER_LAB-f377 20000000059303 OTLC-ADM-gucore-redhat.com-DEV_OCP_HA_LAB-442f [user@work cloudforms-oob]$ ./get_svc.sh | ./delete_svc.sh 20000000059300 OTLC-ADM-gucore-redhat.com-DEV_THREE_TIER_APP-f3b8 20000000059304 OTLC-ADM-gucore-redhat.com-DEV_OCP_WORKSHOP-c53b 20000000059302 OTLC-ADM-gucore-redhat.com-DEV_OCP_DEMO_LAB-1909 20000000059301 OTLC-ADM-gucore-redhat.com-DEV_ANS_TOWER_LAB-f377 20000000059303 OTLC-ADM-gucore-redhat.com-DEV_OCP_HA_LAB-442f
Order Red Hat CloudForms (or ManageIQ) services in bulk via the API. You must provide a catalog name and catalog item (in text format).
Argument | Comment |
---|---|
Username |
If you do not provide a user name, you will be prompted for one. |
Total Requests |
|
Group Count and Wait |
|
API Wait |
|
URI |
|
Keypairs |
|
Non-Interactive |
Use |
Use this script with caution!
INPUT: each line is a service to delete. Each line must be of the form:
ID NAME
for example:
20000000056794 OTLC-ADM-gucore-redhat.com-DEV_THREE_TIER_APP-a63d
You can pipe the output of get_svc.sh
to delete_svc.sh
:
./get_svc.sh | grep OCP | ./delete_svc.sh
Error: Usage $0 [-u <username>] [ -w <uri> ] This script reads the input from STDIN. Each line should be ID NAME of service to retire. ex: . credentials.rc; ./get_svc.sh | grep 'OCP'| ./delete_svc.sh
Password cannot be prompted because the script already reads from STDIN. It has to be set as an env variable.
The mandatory variables are:
-
username
-
password
-
uri
You can set the mandatory variables as environment variables, with export password=…
for password, username and uri or source it from a file. Then the script can be run without interaction.
Example:
. credentials.rc ; ./order_svc.sh -t 20 -g 5 -c 'OPENTLC Cloud Infrastructure Labs' -i 'DEV 3 Tier App' -y . credentials.rc ; ./get_svc.sh # check output before deleting! # delete all your services: . credentials.rc ; ./get_svc.sh | ./delete_svc.sh