oci_instance_configuration - Manage Instance Configurations in OCI

New in version 2.5.

Synopsis

  • This module allows the user to create, update and delete an Instance Configuration in OCI.

Requirements

The below requirements are needed on the host that executes this module.

Parameters

Parameter Choices/Defaults Comments
api_user
The OCID of the user, on whose behalf, OCI APIs are invoked. If not set, then the value of the OCI_USER_OCID environment variable, if any, is used. This option is required if the user is not specified through a configuration file (See config_file_location). To get the user's OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_fingerprint
Fingerprint for the key pair being used. If not set, then the value of the OCI_USER_FINGERPRINT environment variable, if any, is used. This option is required if the key fingerprint is not specified through a configuration file (See config_file_location). To get the key pair's fingerprint value please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_key_file
Full path and filename of the private key (in PEM format). If not set, then the value of the OCI_USER_KEY_FILE variable, if any, is used. This option is required if the private key is not specified through a configuration file (See config_file_location). If the key is encrypted with a pass-phrase, the api_user_key_pass_phrase option must also be provided.
api_user_key_pass_phrase
Passphrase used by the key referenced in api_user_key_file, if it is encrypted. If not set, then the value of the OCI_USER_KEY_PASS_PHRASE variable, if any, is used. This option is required if the key passphrase is not specified through a configuration file (See config_file_location).
auth_type
    Choices:
  • api_key ←
  • instance_principal
The type of authentication to use for making API requests. By default auth_type="api_key" based authentication is performed and the API key (see api_user_key_file) in your config file will be used. If this 'auth_type' module option is not specified, the value of the OCI_ANSIBLE_AUTH_TYPE, if any, is used. Use auth_type="instance_principal" to use instance principal based authentication when running ansible playbooks within an OCI compute instance.
compartment_id
The OCID of the compartment containing the instance configuration. Required to create an instance configuration.
config_file_location
Path to configuration file. If not set then the value of the OCI_CONFIG_FILE environment variable, if any, is used. Otherwise, defaults to ~/.oci/config.
config_profile_name
The profile to load from the config file referenced by config_file_location. If not set, then the value of the OCI_CONFIG_PROFILE environment variable, if any, is used. Otherwise, defaults to the "DEFAULT" profile in config_file_location.
defined_tags
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm.
force_create
bool
    Choices:
  • no ←
  • yes
Whether to attempt non-idempotent creation of a resource. By default, create resource is an idempotent operation, and doesn't create the resource if it already exists. Setting this option to true, forcefully creates a copy of the resource, even if it already exists.This option is mutually exclusive with key_by.
freeform_tags
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm.
instance_configuration_id
The OCID of the instance configuration. Required to update or delete an instance configuration.

aliases: id
instance_details
Details about the compute instance details that are part of the Instance Configuration. Required to create an instance configuration.
launch_details
Instance launch details
availability_domain
The Availability Domain of the instance.
extended_metadata
Additional metadata key/value pairs that you provide. They serve a similar purpose and functionality from fields in the metadata object. They are distinguished from metadata fields in that these can be nested JSON objects (whereas 'metadata' fields are string/string maps only). If you don't need nested metadata values, it is strongly advised to avoid using this object and use the Metadata object instead.
compartment_id
The OCID of the compartment. Required when state=present.
defined_tags
Defined tags for this resource. Each key is predefined and scoped to a namespace.
create_vnic_details
Details for the primary VNIC that is automatically created and attached when the instance is launched. Required when creating a compute instance with state=present.
skip_source_dest_check Default:
no
Determines whether the source/destination check is disabled on the VNIC. Defaults to false, which means the check is performed.
display_name
A user-friendly name for the VNIC. Does not have to be unique.
private_ip
The private IP to assign to the VNIC. Must be an available IP address within the subnet's CIDR. If you don't specify a value, Oracle automatically assigns a private IP address from the subnet. This is the VNIC's primary private IP address.
hostname_label
The hostname for the VNIC's primary private IP. Used for DNS. The value is the hostname portion of the primary private IP's fully qualified domain name (FQDN) (for example, bminstance-1 in FQDN bminstance-1.subnet123.vcn1.oraclevcn.com). Must be unique across all VNICs in the subnet and comply with RFC 952 and RFC 1123.
assign_public_ip
Determines whether the VNIC should be assigned a public IP address. If not set and the VNIC is being created in a private subnet (that is, where prohibitPublicIpOnVnic = true in the Subnet), then no public IP address is assigned. If not set and the subnet is public prohibitPublicIpOnVnic = false, then a public IP address is assigned. If set to true and prohibitPublicIpOnVnic = true, an error is returned.
subnet_id
required
The OCID of the subnet to create the VNIC in.
freeform_tags
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace.
shape
The shape of the instance.
source_details
required
Details for creating an instance. Use this parameter to specify whether a boot volume or an image should be used to launch a new instance.
boot_volume_id
The OCID of the boot volume used to boot the instance. Required if source_type is "bootVolume".
image_id
The OCID of the image used to boot the instance. Required if source_type is "image".
boot_volume_size_in_gbs
The size of the boot volume in GBs. The minimum value is 50 GB and the maximum value is 16384 GB (16TB).
source_type
required
    Choices:
  • image
  • bootVolume
The source type for the instance. Use image when specifying the image OCID. Use bootVolume when specifying the boot volume OCID.
ipxe_script
custom iPXE script that will run when the instance boots.
display_name
A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
metadata
A hash/dictionary of custom key/value pairs that are associated with the instance. This option is also used to provide information to cloud-init and specifying "ssh_authorized_keys" for the default user of the instance. This hash is specified as '{"key":"value"}' and '{"key":"value", "key":"value"}'.
instance_type
required
    Choices:
  • compute
The type of instance details. Supported instanceType is compute
block_volumes
A list of new block volumes to create, or attach to an existing volume.
attach_details
Volume attachment details.
display_name
A user-friendly name. Does not have to be unique, and it cannot be changed. Avoid entering confidential information.
use_chap Default:
no
Whether to use CHAP authentication for the volume attachment.
is_read_only Default:
no
Whether the attachment was created in read-only mode.
type
    Choices:
  • iscsi
  • paravirtualized
The type of volume. Required to specify the attachment of a volume in the instance configuration.
create_details
Details for creating a new Block volume
backup_policy_id
If provided, specifies the ID of the volume backup policy to assign to the newly created volume. If omitted, no policy will be assigned.
availability_domain
The availability domain of the volume.
display_name
A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
compartment_id
The OCID of the compartment that contains the volume.
defined_tags
Defined tags for this resource. Each key is predefined and scoped to a namespace.
freeform_tags
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace
source_details
Specifies the volume source details for a new Block volume. The volume source is either another Block volume in the same Availability Domain or a Block volume backup. This is an optional field. If not specified or set to null, the new Block volume will be empty. When specified, the new Block volume will contain data from the source volume or backup.
type
    Choices:
  • volumeBackup
  • volume
Type of volume source details. Use source_details.type=volumeBackup for restoring a volume backup. Use source_details.type=volume for cloning a volume.
id
The OCID of the volume backup from which the data should be restored on the newly created volume when source_details.type=volumeBackup or the OCID of the volume to be cloned when source_details.type=volume.
size_in_gbs
The size of the volume in GBs.
volume_id
The OCID of the volume.
secondary_vnics
Details of secondary VNICs attached with the instance
nic_index
Specifies the physical network interface card (NIC) the VNIC will use. Defaults to 0. Certain bare metal instance shapes have two active physical NICs (0 and 1). When a secondary VNIC is added to one of these instances, the NIC that the VNIC will use can be specified using nic_index. This option may be specified while creating a VNIC and attaching to an instance using state=present.
create_vnic_details
Details for creating a new secondary VNIC. This option must be specified when a secondary VNIC needs to be created and associated with an instance using state=present.
skip_source_dest_check Default:
no
Determines whether the source/destination check is disabled on the VNIC. Defaults to false, which means the check is performed.
display_name
A user-friendly name for the VNIC. Does not have to be unique.
private_ip
The private IP to assign to the VNIC. Must be an available IP address within the subnet's CIDR. If you don't specify a value, Oracle automatically assigns a private IP address from the subnet. This is the VNIC's primary private IP address.
hostname_label
The hostname for the VNIC's primary private IP. Used for DNS. The value is the hostname portion of the primary private IP's fully qualified domain name (FQDN) (for example, bminstance-1 in FQDN bminstance-1.subnet123.vcn1.oraclevcn.com). Must be unique across all VNICs in the subnet and comply with RFC 952 and RFC 1123.
assign_public_ip
Determines whether the secondary VNIC should be assigned a public IP address. If not set and the VNIC is being created in a private subnet (that is, where prohibitPublicIpOnVnic = true in the Subnet), then no public IP address is assigned. If not set and the subnet is public prohibitPublicIpOnVnic = false, then a public IP address is assigned. If set to true and prohibitPublicIpOnVnic = true, an error is returned.
subnet_id
The OCID of the subnet to create the VNIC in.
display_name
A user-friendly name to be associated with the VNIC attachment. This does not have to be unique, and can be changed later.
key_by
The list of comma-separated attributes of this resource which should be used to uniquely identify an instance of the resource. By default, all the attributes of a resource except freeform_tags are used to uniquely identify a resource.
name
A user-friendly name for the instance configuration

aliases: display_name
region
The Oracle Cloud Infrastructure region to use for all OCI API requests. If not set, then the value of the OCI_REGION variable, if any, is used. This option is required if the region is not specified through a configuration file (See config_file_location). Please refer to https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm for more information on OCI regions.
state
    Choices:
  • present ←
  • absent
Create or update an instance configuration with state=present. Use state=absent to delete an instance configuration.
tenancy
OCID of your tenancy. If not set, then the value of the OCI_TENANCY variable, if any, is used. This option is required if the tenancy OCID is not specified through a configuration file (See config_file_location). To get the tenancy OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm

Examples

- name: Create an instance configuration that describes launch details for a compute instance of VM.Standard2.1 shape
        and a specific image. No details are provided for additional block volume attachments or secondary VNICs
  oci_instance_configuration:
    name: "backend-servers"
    compartment_id: "ocid1.compartment.oc1..xxxxxEXAMPLExxxxx...vm62xq"
    instance_details:
        instance_type: "compute"
        launch_details:
            compartment_id: "ocid1.compartment.oc1..xxxxxEXAMPLExxxxx...vm62xq"
            shape: "VM.Standard2.1"
            source_details:
                source_type: "image"
                image_id: "ocid1.image.oc1.phx.xxxxxEXAMPLExxxxx...sa7klnoa"
            metadata:
                foo: bar

- name: Create an instance configuration that describes launch details for a compute instance of VM.Standard2.1 shape
        and a specific image, with additional block volume details (stating that a new block volume must be created and
        that it must be a clone of an existing volume, and an existing iscsi volume be attached)
  oci_instance_configuration:
    name: "backend-servers"
    compartment_id: "ocid1.compartment.oc1..xxxxxEXAMPLExxxxx...vm62xq"
    instance_details:
        instance_type: "compute"
        launch_details:
            compartment_id: "ocid1.compartment.oc1..xxxxxEXAMPLExxxxx...vm62xq"
            shape: "VM.Standard2.1"
            source_details:
                source_type: "image"
                image_id: "ocid1.image.oc1.phx.xxxxxEXAMPLExxxxx...sa7klnoa"
        block_volumes:
            - create_details:
                source_details:
                    type: volume
                    id: ocid1.volume.oc1.iad.xxxxxEXAMPLExxxxx...abcd
              attach_details:
                type: iscsi
                volume_id: ocid1.volume.oc1.phx.xxxxxEXAMPLExxxxx...defg

- name: Update an instance configuration's display name
  oci_instance_configuration:
    id: ocid1.instanceconfiguration.oc1.phx.xxxxxEXAMPLExxxxx...rz3fhq
    name: "old-backend-servers"

- name: Delete an instance configuration
  oci_instance_configuration:
    id: ocid1.instanceconfiguration.oc1.phx.xxxxxEXAMPLExxxxx...rz3fhq
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
instance_configuration
complex
On successful create, delete operations on instance configurations
Information about the Instance Configuration

Sample:
{'instance-details': {'block-volumes': None, 'secondary-vnics': None, 'instance-type': 'compute', 'launch-details': {'source-details': {'source-type': 'image', 'image-id': 'ocid1.image.oc1.iad.xxxxxEXAMPLExxxxx...ayda'}, 'extended-metadata': None, 'defined-tags': None, 'compartment-id': 'ocid1.compartment.oc1..xxxxxEXAMPLExxxxx...mkwq', 'shape': 'VM.Standard2.1', 'ipxe-script': None, 'create-vnic-details': {'hostname-label': None, 'assign-public-ip': True, 'private-ip': None, 'display-name': 'siva-test-3', 'skip-source-dest-check': False, 'subnet-id': None}, 'availability-domain': None, 'display-name': 'siva-test-3', 'freeform-tags': None, 'metadata': {'user_data': 'dW5kZWZpbmVk', 'ssh_authorized_keys': 'ssh-rsa ...k8Id/ug/xxxxxEXAMPLExxxxx...RYzAEYT foo@bar'}}}, 'time-created': '2018-11-07T04:16:20.454000+00:00', 'defined-tags': {}, 'compartment-id': 'ocid1.compartment.oc1..xxxxxEXAMPLExxxxx...mkwq', 'id': 'ocid1.instanceconfiguration.oc1.iad.xxxxxEXAMPLExxxxx...ejka', 'display-name': 'siva-test-conf-3', 'freeform-tags': {}, 'deferred-fields': ['instanceDetails.launchDetails.availabilityDomain', 'instanceDetails.launchDetails.createVnicDetails.subnetId']}
  display_name
string
always
A user-friendly name for the instance configuration

Sample:
backend-servers
  compartment_id
string
always
The OCID of the compartment containing the instance configuration.

Sample:
ocid1.compartment.oc1..xxxxxEXAMPLExxxxx
  defined_tags
string
always
Defined tags for this resource. Each key is predefined and scoped to a namespace.

Sample:
{'Operations': {'CostCenter': '42'}}
  deferred_fields
list
always
List of deferred fields

Sample:
["instanceDetails.launchDetails.availabilityDomain", "instanceDetails.launchDetails.createVnicDetails.subnetId"]
  freeform_tags
string
always
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace.

Sample:
{'Department': 'Finance'}
  instance_details
string
always
Details of the instance

  time_created
string
always
The date and time the instance configuration was created, in the format defined by RFC3339.

Sample:
2018-11-07T04:16:20.454000+00:00
  id
string
always
The OCID of the instance configuration.

Sample:
ocid1.instanceconfiguration.oc1.phx.xxxxxEXAMPLExxxxx...rz3fhq


Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Author

  • Sivakumar Thyagarajan (@sivakumart)

Hint

If you notice any issues in this documentation you can edit this document to improve it.