Skip to main content
Version: Deploy 22.3

Discover middleware using the Deploy CLI

This topic covers using the discovery feature to automatically create an accurate model of your infrastructure in Deploy. During discovery, Deploy scans your middleware environment and creates configuration items (CIs) in the repository. Discovery is part of the Deploy plugin suite, and the exact discovery functionality available depends on the middleware platforms that are present in your environment.

Note: Automatically discovered CIs can be incomplete. For CIs with properties that cannot be discovered automatically, such as passwords, you must fill in these properties manually.

Discovery has the following steps:

  1. Create a CI representing the starting point for discovery (this is often a host CI).
  2. Start discovery with this CI.
  3. Store the discovered CIs in the repository.
  4. Complete the discovered CIs by filling in missing properties manually (if needed).
  5. Add the discovered CIs to an environment.

Step 1 - Create a starting point

The starting point in most situations is a host CI. Depending on the middleware you are trying to discover, additional parameters may be required.

This example creates a CI for localhost and then creates a CI for a demo server. This CI is the starting point for discovery.

host = factory.configurationItem('Infrastructure/demoHost', 'overthere.LocalHost')
host.os = 'UNIX'
repository.create(host)

server = factory.configurationItem('Infrastructure/demoHost/demoServer', 'demo.Server')
server.host = host.id

Step 2 - Create and execute the discovery task

taskId = deployit.createDiscoveryTask(server)
deployit.startTaskAndWait(taskId)
discoveredCIs = deployit.retrieveDiscoveryResults(taskId)

The output of these commands is an object containing a list of discovered middleware CIs.

Step 3 - Store the discovered CIs

At this stage, CIs are not persisted. To store them in the repository, execute:

repository.create(discoveredCIs)

Step 4 - Complete discovered middleware CIs

To identify which CIs require additional information, print them.

  1. Print the stored CIs:
    deployit.print(repository.read(ci.id));
  2. CIs that contain passwords will displayed as ********. Fill in all required passwords.

Note: If the CIs have already been stored in the repository, you can edit them in the Deploy GUI.

Adding CIs to environments

Middleware that is used as a deployment target must be grouped in an environment. Environments are CIs of type udm.Environment.

  1. Create CIs from the CLI using the following command:

    env = factory.configurationItem('Environments/DiscoveredEnv', 'udm.Environment')
  2. Add the discovered CIs to the environment:

    env.values['members'] = [ci.id for ci in discoveredCIs]

    Note: Not all discovered CIs must be stored in an environment. Example: for WAS, some nested CIs may be discovered that only require the top-level to be stored.

  3. To store the new environment in the repository, execute the following command:

    repository.create(env)

The newly created environment can be used as a deployment target.

Note: You must have specific permission to store CIs in the database.