Skip to content

Instantly share code, notes, and snippets.

@npearce
Last active August 24, 2018 21:46
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save npearce/acc88aa51ab0e886955ef377908e55f5 to your computer and use it in GitHub Desktop.
F5 iControl LX workers: Install and Uninstall RPM's

About

The F5 iControl LX Framework enables engineers to create custom Nodejs control-plane actions/workflows for the F5 BIG-IP hardware and software appliances.

Put the RPM on the BIG-IP

Copy the RPM using scp (or some SCP capabe GUI tool).

SCP instructions

Assuming the following:

  • If the RPM is called: BigStats-0.4.0-0004.noarch.rpm
  • If the local location (on your machine) is: /Users/Bob/Downloads/
  • If the BIG-IP management IP Address is: 172.31.1.20

Then the scp command would be (you will be promped for your admin password):

scp /Users/Bob/Downloads/BigStats-0.4.0-0004.noarch.rpm admin@172.31.1.20:/var/config/rest/downloads/

If your BIG-IP is running on a cloud provider platform, you may also have to provide a certificate, for example:

scp -i "~/Dev/AWS/my_AWS.pem" /Users/Bob/Downloads/BigStats-0.4.0-0004.noarch.rpm admin@172.31.1.20:/var/config/rest/downloads/

Install the RPM

To install the RPM, you must POST the RPMs details to the iCOntrol REST API /package-management-tasks worker, which will perform the installation for you. To do this, using the same example inputs above (substituting <password> with the actual admin password):

curl -u admin:<password> -k -X POST https://172.31.1.20/mgmt/shared/iapp/package-management-tasks -d '{ "operation":"INSTALL","packageFilePath": "/var/config/rest/downloads/BigStats-0.4.0-0004.noarch.rpm"}

The response will look something like this:

{"packageFilePath":"/var/config/rest/downloads/BigStats-0.4.0-0004.noarch.rpm","operation":"INSTALL","id":"fa13463f-6556-44cc-a699-7a7981dcc295","status":"CREATED","userReference":{"link":"https://localhost/mgmt/shared/authz/users/admin"},"identityReferences":[{"link":"https://localhost/mgmt/shared/authz/users/admin"}],"ownerMachineId":"3ed07ac1-8c3e-43c5-aacf-53eebf4cb2f8","generation":1,"lastUpdateMicros":1524932793810249,"kind":"shared:iapp:package-management-tasks:iapppackagemanagementtaskstate","selfLink":"https://localhost/mgmt/shared/iapp/package-management-tasks/fa13463f-6556-44cc-a699-7a7981dcc295"}

To verify it was installed successfully, grab the task id from the response in the previous step, (in this example "id":"fa13463f-6556-44cc-a699-7a7981dcc295") and append that to a GET request to the /package-management-tasks worker. For example:

curl -u admin:<password> -k -X GET https://172.31.1.20/mgmt/shared/iapp/package-management-tasks/fa13463f-6556-44cc-a699-7a7981dcc295

The response:

{"packageFilePath":"/var/config/rest/downloads/BigStats-0.4.0-0004.noarch.rpm","packageName":"BigStats-0.4.0-0004.noarch","operation":"INSTALL","packageManifest":{"tags":["IAPP"]},"id":"36204b98-1425-4220-8267-8d704d7cea4e","status":"FINISHED","startTime":"2018-08-24T09:38:23.692-0700","endTime":"2018-08-24T09:38:24.443-0700","userReference":{"link":"https://localhost/mgmt/shared/authz/users/admin"},"identityReferences":[{"link":"https://localhost/mgmt/shared/authz/users/admin"}],"ownerMachineId":"d4417bdd-a432-4a1a-be7f-bb692c7b9559","generation":3,"lastUpdateMicros":1535128704443763,"kind":"shared:iapp:package-management-tasks:iapppackagemanagementtaskstate","selfLink":"https://localhost/mgmt/shared/iapp/package-management-tasks/fa13463f-6556-44cc-a699-7a7981dcc295"}

Uninstall

Assuming we are still working with BigStats-0.4.0-0004.noarch.rpm:

curl -u admin:<password> -k -X POST https://172.31.1.20/mgmt/shared/iapp/package-management-tasks -d '{ "operation":"UNINSTALL","packageName": "BigStats-0.4.0-0004.noarch"}'

NOTE: its the filename without the .rpm extension.


Other Useful Commands

How to lookup installed packages and their versions

To see what is installed:

curl -u admin:<password> -k -X GET https://172.31.1.20/mgmt/shared/iapp/global-installed-packages/

The response will look something like:

{"items":[{"id":"2be3a96c-41ce-369c-a6d9-deaefdca14a8","appName":"n8-GheWebhookServer","packageName":"n8-GheWebhookServer-0.2.0-0002.noarch","version":"0.2.0","release":"0002","arch":"noarch","tags":["IAPP"],"generation":1,"lastUpdateMicros":1535041610805529,"kind":"shared:iapp:global-installed-packages:installedpackagestate","selfLink":"https://localhost/mgmt/shared/iapp/global-installed-packages/2be3a96c-41ce-369c-a6d9-deaefdca14a8"},{"id":"3616c231-6973-3608-8d74-1b87fc3d95e0","appName":"BigStats","packageName":"BigStats-0.4.0-0004.noarch","version":"0.4.0","release":"0004","arch":"noarch","tags":["IAPP"],"lastUpdateMicros":1535128704419099,"kind":"shared:iapp:global-installed-packages:installedpackagestate","selfLink":"https://localhost/mgmt/shared/iapp/global-installed-packages/3616c231-6973-3608-8d74-1b87fc3d95e0","generation":4},{"id":"5b78671e-01ea-3d87-b255-4f6da6047846","appName":"f5-appsvcs","packageName":"f5-appsvcs-3.2.0-6.noarch","version":"3.2.0","release":"6","arch":"noarch","tags":["IAPP"],"generation":1,"lastUpdateMicros":1535042348134036,"kind":"shared:iapp:global-installed-packages:installedpackagestate","selfLink":"https://localhost/mgmt/shared/iapp/global-installed-packages/5b78671e-01ea-3d87-b255-4f6da6047846"}],"generation":6,"kind":"shared:iapp:global-installed-packages:installedpackagecollectionstate","lastUpdateMicros":1535128704419543,"selfLink":"https://localhost/mgmt/shared/iapp/global-installed-packages"}

For each installed 'iControl LX' worker there is an 'appName' and 'packageName'. Following our example app, BigStats, note the keys/values: "appName":"BigStats","packageName":"BigStats-0.4.0-0004.noarch"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment