Part of the value add of Pivotal Cloud Foundry (PCF) is helping new users with Operations Manager. One of the features is the ability to upload tiles to aid with the deployment of components (like Elastic Run Time, MySQl service, Metrics etc.).
After being involved in a number of customer deployments I realised that using the web interface to upload each tile can be a slow process (unless you are constantly watching the progress). As a result I decided to look at scripting the process so that I can make future deployments a bit more automated, obviously if its just a single tile the follow will add very little value.
It should be noted that some of the members on my team are working on a better automated deployment process using concourse. I will look at this when I get more time.
I decided to write a simple bash script to recursively look through a directory on the file system looking for all files that have the .pivotal extension and then uploading them to the Ops Manager via the OM CLI tool.
You will need to know the FQDN/IP of your Ops manager (target), the user name and password you need to access it. I provided three options to pass this information;
./tile-install <target> <user> <password>
- Using environment variables
$OpsMgr_Target
,$OpsMgr_User
and$OpsMgr_Pass
- Follow the prompts on the screen (example below uses this method)
Example
I uploaded two tiles (cf-1.9.5
and p-mysql-1.8.2
) to a directory on my Ops Manager (~/tiles
) server along with the tile-install.sh
script from here.
.
├── cf-1.9.5-build.3.pivotal
├── om-linux
├── p-mysql-1.8.2.pivotal
├── README.md
└── tile-install.sh
0 directories, 5 files
The Ops Manager UI at this point doesn’t have any additional tiles available (ERT and MySQL in my example here).
I then executed the script;
redwards@om-pcf-1b:~/tiles$ ./tile-install.sh
[ OK ] Discovered OM command set in local directory!
Enter Ops Manager target: opsmgr.gcp.#######.com
Enter Ops Manager Username: admin
[ OK ] User input of params!
Tiles found in the directory;
./p-mysql-1.8.2.pivotal
./cf-1.9.5-build.3.pivotal
[ ? ] Do you want to proceed and install the listed tiles? (y/n) y
processing product
beginning product upload to Ops Manager
1.02 GB / 1.02 GB [===================================================================================] 100.00% 18s
2m27s elapsed, waiting for response from Ops Manager...
finished upload
[ OK ] Install tile ./p-mysql-1.8.2.pivotal
processing product
beginning product upload to Ops Manager
4.96 GB / 4.96 GB [=================================================================================] 100.00% 2m33s
8m15s elapsed, waiting for response from Ops Manager...
finished upload
[ OK ] Install tile ./cf-1.9.5-build.3.pivotal
[ OK ] Completed Script
Next steps
Once the v1.10 release is out enhanced API should allow the upload of tile configuration as well, I will then look to enhance so that the configuration can be automated.
I also want to look at how I can also add the tile once it is uploaded to Ops Manager.