Importing a Template

Import a custom template file into Oracle Cloud Stack.

The value of the templateName attribute in the file is used as the name of the template in Oracle Cloud Stack. The actual name of the template source file is not used by Oracle Cloud Stack to identify a template. If you import a template with the same name as an existing template but with a newer templateVersion, you replace the existing one. Any existing stacks that were created from previous versions of this template are not affected. See Editing a Template.

Importing a Published Template with the Console

Use the web console to import a template file into Oracle Cloud Stack. The template is automatically published and is available to all users in this account for the creation of cloud stacks.

  1. Access the Oracle Cloud Stack console, and then click Templates.
  2. Click Import.
  3. Select one of the following options:
    • Template File — Click Choose File and select the YAML template file on your local machine.
    • Template URL — Enter the URL to the YAML template file.
  4. Click Import.
    The format and contents of the template file are automatically validated. If any validation errors are found, you must edit the template file, correct the problems and then import again.
  5. Verify the presence of your template on the Templates page.

    You can also use the Search input field to locate your template.

Importing an Unpublished Template with the Console

Use the web console to import a unpublished (draft) template file into Oracle Cloud Stack. The template cannot be used to create stacks until it is published.

Before importing an unpublished template for the first time, see Configuring Template Storage.

  1. Access the Oracle Cloud Stack console, and then click Templates.
  2. Click Unpublished.
  3. Click Add Template, and then select Import existing Template.
  4. Navigate to and select the YAML template file on your local machine.
  5. Verify the presence of your template on the Unpublished Templates page.

    You can also use the Search input field to locate your template.

After making any modifications to the imported template with the console, you can publish it. See Publishing a Template.

Importing a Template with the CLI

Use the CLI to import a template file into Oracle Cloud Stack.

  1. Execute the stack import-template command.

    Provide the fully-qualified path of the template YAML file on your local file system:

    psm stack import-template -f filePath 

    For example:

    psm stack import-template -f /home/oracle/cloud/myappdev_stack_template.yaml
    
    "status":"Template [myappdev:1.0.0] saved successfully"

    The format and contents of the template file are automatically validated. Any validation errors are provided in the output of this command.

  2. Execute the stack describe-template command to verify the presence of your new template:
    psm stack describe-template -n name

    For example:

    psm stack describe-template -n myappdev

    Note:

    You can also view a list of all templates in this account by using the stack list-templates command. The output of both of these commands include a list of stack names that were created from this template.

You can also validate a template file without importing it. See Validating a Template.

For more information about the CLI commands for Oracle Cloud Stack, see psm stack Commands.