Reply
Explorer
Posts: 8
Registered: ‎04-20-2017
Accepted Solution

Adding a deployment through Director Rest API

I'd like to add a deployment to my existing environment using the Rest API, with an existing external Database Server, and using existing instance templates. I found in the API docs, that this is the way to add a deployment, but this creates a new template, however I want to use my existing ones. Is it possible to reference them somehow?

 

{
  "name": "",
  "managerVirtualInstance": {
    "id": "",
    "template": {
      "name": "",
      "type": "",
      "image": "",
      "config": "object",
      "tags": "object",
      "normalizeInstance": false,
      "sshUsername": "",
      "bootstrapScripts": [
        ""
      ]
    }
  },
  "externalDatabaseTemplates": [
    {
      "key": {
        "name": "",
        "databaseServerName": "",
        "databaseNamePrefix": "",
        "usernamePrefix": ""
      }
    }
  ],
  "externalDatabases": [
    {
      "key": {
        "type": "",
        "host": "",
        "port": 0,
        "name": "",
        "user": "",
        "password": ""
      }
    }
  ],
  "configs": [
    {
      "key": "object"
    }
  ],
  "hostname": "",
  "port": 0,
  "username": "",
  "password": "",
  "repository": "",
  "repositoryKeyUrl": "",
  "enableEnterpriseTrial": false,
  "unlimitedJce": false,
  "krbAdminUsername": "",
  "krbAdminPassword": "",
  "javaInstallationStrategy": "",
  "license": "",
  "billingId": "",
  "postCreateScripts": [
    ""
  ],
  "csds": [
    ""
  ]
}
Highlighted
Cloudera Employee
Posts: 40
Registered: ‎02-18-2014

Re: Adding a deployment through Director Rest API

Hi ztoth,

 

The API doesn't support referencing an existing instance template when creating a new deployment through it. The entire instance template for the manager instance must be spelled out. To make this easier, you can GET the template for an existing deployment (not the deployment itself, but its template) that uses the desired instance template, and then copy out the details from the returned JSON.

 

Going further, you can edit the JSON from that existing deployment template into what you POST for the new one, essentially rolling your own clone operation. If you do this, be sure to update the rest of the template to make it properly independent of the original: change the name of the deployment, change the ID for the manager virtual instance, update any bootstrap scripts, fill in the license and billing ID if used, and update database names and credentials for any pre-existing external databases.

 

If you're also looking at reusing an external database server, once it's created it can be referenced inside external database templates and (existing) external databases in new deployment templates by its name, and it will be used as expected.

Announcements