If you are spinning up and destroying dev and test environments regularly (for example, with Ansible) and deploying applications with UrbanCode Deploy, you may have run into the problem of UrbanCode Deploy agents remaining “connected” and counted when you don’t want that behavior.
The most straightforward way to avoid orphaned UrbanCode Deploy agents is to use the UrbanCode Deploy Blueprint Designer to stand up environments. The Blueprint Designer knows how to provision the “full stack” for an application using Terraform, and then call UrbanCode Deploy to deploy the application, track versions and orchestrate the deployment. When you destroy the environment (on IBM Cloud, Azure, Google Cloud or AWS), the UrbanCode Blueprint Designer will clean up the UrbanCode Deploy agent from the environment, removing it from the UCD dashboard and releasing the related license key.
This is the recommended approach for full stack provisioning and deployment of apps, but if you are using another tool to provision the environment, there is a way to clean up the UCD agents:
- As part of Ansible scripting used to provision and de-provision an environment, API calls could be made to remove/delete UCD agents and resources. See information on CLI commands here.
- The deleteEnvironment command will remove the entire environment. If you specify deleteAttachedResources and deleteCloudInstances to be true, then all the attached resources for the environment will be deleted and all agents will be marked to be deleted when they go offline (and release related license keys).