26 Orchestration v2

This section describes the Compute Classic CLI commands you can use to add, delete, update, and view orchestration v2.

An orchestration defines the attributes and interdependencies of a collection of compute, networking, and storage resources in Compute Classic. You can use orchestrations to automate the provisioning and lifecycle operations of an entire virtual compute topology.

In earlier versions of Compute Classic, you could use orchestrations v1 to create and manage resources. From release 17.1.2 onwards, you can also create and provision resources using orchestrations v2.

Note:

You should always use your orchestrations to manage resources that you've created using orchestrations. Don't, for example, use the web console, CLI commands, or REST API requests to delete an object that you created using an orchestration. This could cause your orchestration to either attempt to re-create the object and associated resources, or to go into an error state.

Also remember that you shouldn't try to use or manage resources created using orchestrations v1 by referencing them in orchestrations v2, or vice versa.

For more information, see About Orchestrations v2 in Using Oracle Cloud Infrastructure Compute Classic.

Before running the CLI commands described in this section, make sure that you've installed the CLI client and set up the required environment variables as described in Preparing to Use the CLI.

orchestration-v2 add

To use an orchestration to control the provisioning and life cycle of objects in Compute Classic, you must define the orchestration in a JSON-format file and then use this request to add an orchestration to Compute Classic. You can define all your cloud resources in a single orchestration and manage the resources individually.

Prerequisites

  • You must have already created the orchestration file that you want to upload. See Building Your First Orchestration v2 in Using Oracle Cloud Infrastructure Compute Classic.

  • You should also validate your JSON file. You can do this by using a third-party tool, such as JSONLint, or any other validation tool of your choice. If your JSON isn't valid, then an error occurs when you upload the orchestration. Oracle doesn't support or endorse any third-party validation tool.

If you upload an orchestrations v2 file with the desired_state specified as active, the orchestration is activated automatically and the objects defined in it are created. If you upload an orchestration with the desired_state specified as inactive, the orchestration is added but the objects specified in the orchestration are not created. You can activate the orchestration later to create all the objects that you have defined in the orchestration JSON file. See orchestration-object update.

Required Role

To complete this task, you must have the Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

Syntax

opc compute orchestration-v2 add request-body  

For help with the parameters and options of this command, run the command with the -h option.

Example Command

opc -f json compute orchestration-v2 add ./orchv2.json

Example of orchv2.json

The following is an example of a JSON-formatted file showing the attributes for a single security list object which is provided in an orchestration called /Compute-acme/jack.jones@example.com/firstOrchestration. As the desired_state is specified as inactive, so the orchestration is added to Compute Classic but the security list is not created.

{
	"desired_state": "inactive",
	"name": "/Compute-acme/jack.jones@example.com/firstOrchestration",
	"objects": [{
		"template": {
			"name": "/Compute-acme/jack.jones@example.com/seclist"
		},
		"label": "my-first-seclist",
		"type": "SecList"
	}]
}

Sample Output

{
	"status": "inactive",
	"account": "/Compute-acme/default",
	"time_updated": null,
	"description": "",
	"tags": [],
	"uri": "https://api-z999.compute.us0.oraclecloud.com/platform/v1/orchestration/Compute-acme/jack.jones@example.com/firstOrchestration",
	"time_created": "2017-03-08T14:14:25Z",
	"name": "/Compute-acme/jack.jones@example.com/firstOrchestration",
	"time_audited": null,
	"objects": [{
		"relationships": [],
		"account": "/Compute-acme/default",
		"time_updated": null,
		"description": "",
		"user": "/Compute-acme/jack.jones@example.com",
		"persistent": false,
		"uri": "https://api-z999.compute.us0.oraclecloud.com/platform/v1/object/Compute-acme/jack.jones@example.com/firstOrchestration/c18a1d1b-fdf4-48fd-b6f7-271bfa4d8bd7",
		"template": {
			"name": "/Compute-acme/jack.jones@example.com/seclist"
		},
		"label": "my-first-seclist",
		"time_audited": null,
		"version": 1,
		"health": {
			"status": "inactive"
		},
		"time_created": "2017-03-08T14:14:25Z",
		"orchestration": "/Compute-acme/jack.jones@example.com/firstOrchestration",
		"type": "SecList",
		"name": "/Compute-acme/jack.jones@example.com/firstOrchestration/c18a1d1b-fdf4-48fd-b6f7-271bfa4d8bd7"
	}],
	"user": "/Compute-acme/jack.jones@example.com",
	"version": 1,
	"id": "dd3d3d40-a2ab-434f-be5c-1acfbb200872",
	"desired_state": "inactive"
}

orchestration-v2 list

Retrieves details of all the orchestrations that are available in the specified container and match the specified query criteria. To filter the search results, you can pass one or more tags as query criteria. If you don't specify any tags, then details of all the orchestrations in the container are displayed.

Required Role

To complete this task, you must have the Compute_Monitor or Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

Syntax

opc compute orchestration-v2 list container [--tags tags]

For help with the parameters and options of this command, run the command with the -h option.

Example

opc compute orchestration-v2 list /Compute-acme/jack.jones@example.com

Sample Output

Some lines have been truncated with ellipses (...) for readability. When you run the command in your environment, you'll see the full output.

NAME
/Compute-acme/jack.jones@example.com/firstOrchestration

orchestration-v2 get

Retrieves details of the specified orchestration v2.

You can use the get command to verify whether add and update operations were completed successfully. Use the -F option (for example, -F status) to filter the output for specific attributes.

Required Role

To complete this task, you must have the Compute_Monitor or Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

Syntax

opc compute orchestration-v2 get name

For help with the parameters and options of this command, run the command with the -h option.

Example

opc -f json compute orchestration-v2 get /Compute-acme/jack.jones@example.com/firstOrchestration

Sample Output

{
	"status": "active",
	"account": "/Compute-acme/default",
	"time_updated": "2017-03-08T17:00:20Z",
	"description": "",
	"tags": [],
	"uri": "https://api-z999.compute.us0.oraclecloud.com/platform/v1/orchestration/Compute-acme/jack.jones@example.com/firstOrchestration",
	"time_created": "2017-03-08T14:14:25Z",
	"name": "/Compute-acme/jack.jones@example.com/firstOrchestration",
	"time_audited": "2017-03-08T18:34:32Z",
	"objects": [{
		"relationships": [],
		"account": "/Compute-acme/default",
		"time_updated": "2017-03-08T17:00:20Z",
		"description": "",
		"user": "/Compute-acme/jack.jones@example.com",
		"persistent": false,
		"uri": "https://api-z999.compute.us0.oraclecloud.com/platform/v1/object/Compute-acme/jack.jones@example.com/firstOrchestration/c18a1d1b-fdf4-48fd-b6f7-271bfa4d8bd7",
		"template": {
			"name": "/Compute-acme/jack.jones@example.com/seclist"
		},
		"label": "my-first-seclist",
		"time_audited": "2017-03-08T18:34:23Z",
		"version": 2,
		"health": {
			"status": "active",
			"object": {
				"account": "/Compute-acme/default",
				"description": "",
				"uri": "https://api-z999.compute.us0.oraclecloud.com/seclist/Compute-acme/jack.jones@example.com/seclist",
				"outbound_cidr_policy": "PERMIT",
				"policy": "DENY",
				"name": "/Compute-acme/jack.jones@example.com/seclist"
			}
		},
		"time_created": "2017-03-08T14:14:25Z",
		"orchestration": "/Compute-acme/jack.jones@example.com/firstOrchestration",
		"type": "SecList",
		"name": "/Compute-acme/jack.jones@example.com/firstOrchestration/c18a1d1b-fdf4-48fd-b6f7-271bfa4d8bd7"
	}],
	"user": "/Compute-acme/jack.jones@example.com",
	"version": 2,
	"id": "dd3d3d40-a2ab-434f-be5c-1acfbb200872",
	"desired_state": "active"
}

orchestration-v2 discover

Required Role

To complete this task, you must have the Compute_Monitor or Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

Syntax

opc compute orchestration-v2 discover container

For help with the parameters and options of this command, run the command with the -h option.

Example

opc compute orchestration-v2 discover /Compute-acme/jack.jones@example.com

Sample Output

/Compute-acme/jack.jones@example.com/simple_orchestration
/Compute-acme/jack.jones@example.com/firstOrchestration

orchestration-v2 update

You can update the body of the orchestration or change the state of the orchestration.

Before updating the body of an orchestration-v2:

  1. Get the latest version of the orchestration by running the orchestration-v2 get command.

  2. Modify the orchestration as per your requirements. Ensure that you specify the latest version of the orchestration in the request body.

  3. You should also validate your JSON file. You can do this by using a third-party tool, such as JSONLint, or any other validation tool of your choice. If your JSON isn't valid, then an error occurs when you upload the orchestration. Oracle doesn't support or endorse any third-party validation tool.

You can also change the state of the orchestration and all the objects specified in the orchestration by changing the value of the desired_state parameter of orchestration-v2.

Value of desired_state parameter Description
active Activates an orchestration and creates the objects defined in it.
suspend Deletes all the nonpersistent objects defined in the orchestration. When you suspend an active orchestration, only the nonpersistent objects are deleted; the persistent objects are not deleted.
inactive Deletes all the objects defined in an orchestration. You this option when you want to delete all the objects defined in an orchestration, but retain the orchestration.

You cannot update an orchestration when it is in a transient state, such as activating, suspending, or deactivating state. However, you can terminate or delete an orchestration irrespective of the current state of the orchestration.

Note:

Do not use this command to add, remove, or modify individual objects. Instead use the Orchestration Object commands. You can use this command to modify multiple objects in an orchestration.

Required Role

To complete this task, you must have the Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

Syntax

  • To change only the state of orchestration v2:

    opc compute orchestration-v2 update name [--desired-state state]
  • To update the body of the orchestration v2, including the state of the orchestration:

opc compute orchestration-v2 update name request-body [--desired-state state]

For help with the parameters and options of this command, run the command with the -h option.

Example: Activating an orchestration-v2

The following example shows how to activate an orchestration, /Compute-acme/jack.jones@example.com/firstOrchestration by specifying the desired-state as active.

opc compute orchestration-v2 update /Compute-acme/jack.jones@example.com/firstOrchestration --desired-state=active

Sample Output

{
	"status": "activating",
	"account": "/Compute-acme/default",
	"time_updated": "2017-03-08T17:00:20Z",
	"description": "",
	"tags": [],
	"uri": "https://api-z999.compute.us0.oraclecloud.com/platform/v1/orchestration/Compute-acme/jack.jones@example.com/firstOrchestration",
	"time_created": "2017-03-08T14:14:25Z",
	"name": "/Compute-acme/jack.jones@example.com/firstOrchestration",
	"time_audited": "2017-03-08T17:00:12Z",
	"objects": [{
		"relationships": [],
		"account": "/Compute-acme/default",
		"time_updated": "2017-03-08T17:00:20Z",
		"description": "",
		"user": "/Compute-acme/jack.jones@example.com",
		"persistent": false,
		"uri": "https://api-z999.compute.us0.oraclecloud.com/platform/v1/object/Compute-acme/jack.jones@example.com/firstOrchestration/c18a1d1b-fdf4-48fd-b6f7-271bfa4d8bd7",
		"template": {
			"name": "/Compute-acme/jack.jones@example.com/seclist"
		},
		"label": "my-first-seclist",
		"time_audited": null,
		"version": 2,
		"health": {
			"status": "inactive"
		},
		"time_created": "2017-03-08T14:14:25Z",
		"orchestration": "/Compute-acme/jack.jones@example.com/firstOrchestration",
		"type": "SecList",
		"name": "/Compute-acme/jack.jones@example.com/firstOrchestration/c18a1d1b-fdf4-48fd-b6f7-271bfa4d8bd7"
	}],
	"user": "/Compute-acme/jack.jones@example.com",
	"version": 2,
	"id": "dd3d3d40-a2ab-434f-be5c-1acfbb200872",
	"desired_state": "active"
}

orchestration-v2 delete

After you've terminated an orchestration, if you don't need it any more, you can delete the orchestration. If you want to retain the orchestration but delete the objects created by it, you can terminate the orchestration. See orchestration-object update.

To delete an active orchestration, you must specify true as the value for the terminate parameter.

No response is returned for this command.

Required Role

To complete this task, you must have the Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

Syntax

opc compute orchestration-v2 delete name [--terminate=true]

For help with the parameters and options of this command, run the command with the -h option.

Example 1: Deleting an orchestration which is in the active state

opc compute orchestration-v2 delete /Compute-acme/jack.jones@example.com/simple_orchestration --terminate=true

Example 2: Deleting an orchestration which is in the inactive state

opc compute orchestration-v2 delete /Compute-acme/jack.jones@example.com/firstOrchestration