Delete an Application Created Using a Service-Template from the Service Catalog

Overview

This document describes how to delete an existing application and deploy the changes on your BIG-IP using a service-template and the BIG-IQ 6.0.1 API. Service-templates for approved applications can be added to the Service Catalog by your engineering organization responsible for determining which applications to use and the best practices for each application. Your application can conform to the approved practices of your organization by using the service-template and the BIG-IQ API to create and deploy application updates. This can also help make it easier to automate application management on the Big-IP system.

Prerequisites

  • The BIG-IQ is operational, has completed setup and has all system-level configuration in place.
  • All BIG-IPs are operational and have the services provisioned that will be managed by the BIG-IQ.
  • Trust has been established between the BIG-IP and the BIG-IQ, and the current configuration of the BIG-IP has been discovered on the BIG-IQ.
  • Your engineering or operations team have added an applicable service-template to the BIG-IQ Service Catalog.
  • There is an existing SSG or a single BIG-IP, created with the latest version of BIG-IQ, on which the application has been created and deployed.
  • The network engineer has setup RBAC to provide the application owner with the role resources required to create and destroy applications, use service templates, and deploy to the SSG. BIG-IQ creates associated RBAC configuration as part of application creation process.
  • When performing the tasks in this example, review the listed IP addresses and change them as appropriate for your environment. For example, if you are not running the script directly on the BIG-IQ system, you should change localhost to be the IP address of the BIG-IQ.

Required Information

In addition to meeting the prerequisites, the application owner will need to provide the following information for the application.

  • The application’s name

Actions

Using the BIG-IQ API, the application owner may perform the following actions to collect information and delete the application.

  • List the Application
  • Delete the application and deploy the changes in BIG-IP
  • List the delete and deploy task status

List the Application

Before you delete an application, you need to make sure the application exists in BIG-IQ. To do this, you can send a GET request to the collection and filter by configSetName.

GET https://{ip_address}/mgmt/cm/global/config-sets?$filter=configSetName eq 'app'

Alternatively, you can retrieve the application-state by sending a GET request to the resource identified by it’s id.

GET https://{ip_address}/mgmt/cm/global/config-sets/d2a57dc1-d883-3d21-bb99-51699df71cc7

If the application exists on BIG-IQ, the response body will look like the following.

{
    "selfLink": "https://localhost/mgmt/cm/global/config-sets",
    "totalItems": 1,
    "items": [
        {
            "alertRuleName": "app-health",
            "appDeployConfigTaskReference": {
                "link": "https://localhost/mgmt/cm/global/tasks/app-deploy/525ca5e3-2764-4a7a-ac08-2a7c40fd81eb"
            },
            "configSetName": "app",
            "createDateTime": "2018-05-10T16:28:23.447Z",
            "deviceReference": {
                "link": "https://localhost/mgmt/shared/resolver/device-groups/cm-bigip-allBigIpDevices/devices/35a18732-d42a-4507-bc81-cab532d75d56"
            },
            "domains": [
                {
                    "domainName": "example.con"
                }
            ],
            "generation": 25,
            "id": "d2a57dc1-d883-3d21-bb99-51699df71cc7",
            "kind": "cm:global:config-sets:configsetstate",
            "lastConfigTime": "2018-05-10T16:37:11.342Z",
            "lastDeploymentTime": "2018-05-10T16:37:55.424Z",
            "lastUpdateMicros": 1525970482334255,
            "partition": "Common",
            "protectionMode": "Not Protected",
            "resources": {
                "ltm:virtual:f0f7af86c362": [
                    {
                        "parameters": {
                            "name": "vs",
                            "destinationAddress": "10.12.1.10",
                            "mask": "255.255.255.255",
                            "destinationPort": "23"
                        },
                        "parametersToRemove": [],
                        "subcollectionResources": {
                            "profiles:43ce8df2147c": [
                                {
                                    "parameters": {},
                                    "parametersToRemove": []
                                }
                            ],
                            "profiles:c5b9e00cbb26": [
                                {
                                    "parameters": {},
                                    "parametersToRemove": []
                                }
                            ],
                            "profiles:903e0871361b": [
                                {
                                    "parameters": {},
                                    "parametersToRemove": []
                                }
                            ],
                            "profiles:59e65c10596f": [
                                {
                                    "parameters": {},
                                    "parametersToRemove": []
                                }
                            ]
                        }
                    }
                ],
                "ltm:pool:6dcc5b6619c9": [
                    {
                        "parameters": {
                            "name": "pool"
                        },
                        "parametersToRemove": [],
                        "subcollectionResources": {
                            "members:188fe23d860d": [
                                {
                                    "parameters": {
                                        "port": 1,
                                        "nodeReference": {
                                            "link": "#/resources/ltm:node:95af794ff19e/node1",
                                            "fullPath": "# node1"
                                        }
                                    },
                                    "parametersToRemove": []
                                }
                            ]
                        }
                    }
                ],
                "ltm:node:95af794ff19e": [
                    {
                        "parameters": {
                            "name": "node1",
                            "address": "23.2.1.1"
                        },
                        "parametersToRemove": []
                    }
                ]
            },
            "selfLink": "https://localhost/mgmt/cm/global/config-sets/d2a57dc1-d883-3d21-bb99-51699df71cc7",
            "status": "DONE",
            "subPath": "app",
            "templateReference": {
                "link": "https://localhost/mgmt/cm/global/templates/66f6181b-cb4c-3f4c-938f-bc804a036db6"
            }
        }
    ],
    "generation": 2,
    "kind": "cm:global:config-sets:configsetcollectionstate",
    "lastUpdateMicros": 1526333941840225
}

Delete the application and deploy the changes in BIG-IP

To delete an existing application from BIG-IQ, send a POST request to apply-template. This task will remove the application in BIG-IQ, and by default, it will also remove the application deployed on a single BIG-IP or SSG.

The following example shows an example of a POST request to delete an application named testApp. testApp can be an application in a single BIG-IP or SSG.

POST http://{ip_address}/mgmt/cm/global/tasks/apply-template

{
    "configSetName": "testApp",
    "mode":"DELETE"
}

To delete an application, the following properties need be provided:

Name Type Description
configSetName string Name of the application to be created.
mode string As we are deleting an application, the mode should be ‘DELETE’

List the delete and deploy task status

The body of the response of the POST to apply-template contains a selfLink of the apply-template task. The selfLink will look like this: "http://localhost/mgmt/cm/global/tasks/apply-tempalte/<id>". To check the apply-template task’s status, send a GET request to this selfLink.

GET https://{ip_address}/mgmt/cm/global/tasks/apply-template/<id>

The response may look similar to the following.

    {
        "appDeployConfigTaskReference": {
            "link": "https://localhost/mgmt/cm/global/tasks/app-deploy/9adaa610-c4bc-4c52-9b5b-361b250c2e7f"
        },
        "configSetName": "app",
        "currentStep": "DONE",
        "defaultDeviceReference": {
            "link": "https://localhost/mgmt/shared/resolver/device-groups/cm-bigip-allBigIpDevices/devices/35a18732-d42a-4507-bc81-cab532d75d56"
        },
        "deploy": true,
        "domains": [
            {
                "domainName": "example.com"
            }
        ],
        "endDateTime": "2018-05-14T14:39:01.960-0700",
        "generation": 13,
        "id": "edfae5ac-69aa-443b-bbbb-e6de801f9e8f",
        "identityReferences": [
            {
                "link": "https://localhost/mgmt/shared/authz/users/admin"
            }
        ],
        "kind": "cm:global:tasks:apply-template:applytemplatetaskstate",
        "lastUpdateMicros": 1526333942011707,
        "mode": "DELETE",
        "ownerMachineId": "0dd198e9-aa1a-4514-bdf2-0d45f1a89700",
        "partition": "Common",
        "protectionMode": "Not Protected",
        "resources": {
            "ltm:virtual:f0f7af86c362": [
                {
                    "parameters": {
                        "name": "vs",
                        "destinationAddress": "10.12.1.10",
                        "mask": "255.255.255.255",
                        "destinationPort": "23"
                    },
                    "parametersToRemove": [],
                    "subcollectionResources": {
                        "profiles:43ce8df2147c": [
                            {
                                "parameters": {},
                                "parametersToRemove": []
                            }
                        ],
                        "profiles:c5b9e00cbb26": [
                            {
                                "parameters": {},
                                "parametersToRemove": []
                            }
                        ],
                        "profiles:903e0871361b": [
                            {
                                "parameters": {},
                                "parametersToRemove": []
                            }
                        ],
                        "profiles:59e65c10596f": [
                            {
                                "parameters": {},
                                "parametersToRemove": []
                            }
                        ]
                    }
                }
            ],
            "ltm:pool:6dcc5b6619c9": [
                {
                    "parameters": {
                        "name": "pool"
                    },
                    "parametersToRemove": [],
                    "subcollectionResources": {
                        "members:188fe23d860d": [
                            {
                                "parameters": {
                                    "port": "80",
                                    "nodeReference": {
                                        "link": "#/resources/ltm:node:95af794ff19e/node1",
                                        "fullPath": "# node1"
                                    }
                                },
                                "parametersToRemove": []
                            }
                        ]
                    }
                }
            ],
            "ltm:node:95af794ff19e": [
                {
                    "parameters": {
                        "name": "node1",
                        "address": "23.2.1.1"
                    },
                    "parametersToRemove": []
                }
            ]
        },
        "scriptParameters": {
            "partition": "Common",
            "subPath": "app"
        },
        "selfLink": "https://localhost/mgmt/cm/global/tasks/apply-template/edfae5ac-69aa-443b-bbbb-e6de801f9e8f",
        "startDateTime": "2018-05-14T14:38:22.211-0700",
        "status": "FINISHED",
        "subPath": "app",
        "templateReference": {
            "link": "https://localhost/mgmt/cm/global/templates/66f6181b-cb4c-3f4c-938f-bc804a036db6"
        },
        "userReference": {
            "link": "https://localhost/mgmt/shared/authz/users/admin"
        },
        "username": "admin"
    }
}

Result

Deletes the application configuration in BIG-IQ and from the BIG-IP or SSG. This does not delete the service-template which was used to create the application. This clears the alerts associated with the application.