oracle.oci.oci_container_instances_container – Manage a Container resource in Oracle Cloud Infrastructure

Note

This plugin is part of the oracle.oci collection (version 4.14.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install oracle.oci.

To use it in a playbook, specify: oracle.oci.oci_container_instances_container.

New in version 2.9.0: of oracle.oci

Synopsis

Requirements

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

Parameters

Parameter Choices/Defaults Comments
api_user
string
The OCID of the user, on whose behalf, OCI APIs are invoked. If not set, then the value of the OCI_USER_ID 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
string
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
string
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
string
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_purpose
string
    Choices:
  • service_principal
The auth purpose which can be used in conjunction with 'auth_type=instance_principal'. The default auth_purpose for instance_principal is None.
auth_type
string
    Choices:
  • api_key ←
  • instance_principal
  • instance_obo_user
  • resource_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.
cert_bundle
string
The full path to a CA certificate bundle to be used for SSL verification. This will override the default CA certificate bundle. If not set, then the value of the OCI_ANSIBLE_CERT_BUNDLE variable, if any, is used.
compartment_id
string
The ID of the compartment in which to list resources.
Required for update when environment variable OCI_USE_NAME_AS_IDENTIFIER is set.
config_file_location
string
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
string
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.
container_id
string
The unique identifier for the Container.
Required for update using state=present when environment variable OCI_USE_NAME_AS_IDENTIFIER is not set.

aliases: id
defined_tags
dictionary
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{"foo-namespace": {"bar-key": "value"}}`
This parameter is updatable.
display_name
string
Display name for the Container. There are no guarantees of uniqueness for this name.
Required for update when environment variable OCI_USE_NAME_AS_IDENTIFIER is set.
This parameter is updatable when OCI_USE_NAME_AS_IDENTIFIER is not set.

aliases: name
freeform_tags
dictionary
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{"bar-key": "value"}`
This parameter is updatable.
region
string
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
string
    Choices:
  • present ←
The state of the Container.
Use state=present to update an existing a Container.
tenancy
string
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
wait
boolean
    Choices:
  • no
  • yes ←
Whether to wait for create or delete operation to complete.
wait_timeout
integer
Time, in seconds, to wait when wait=yes. Defaults to 1200 for most of the services but some services might have a longer wait timeout.

Examples

- name: Update container
  oci_container_instances_container:
    # required
    container_id: "ocid1.container.oc1..xxxxxxEXAMPLExxxxxx"

    # optional
    display_name: display_name_example
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}

- name: Update container using name (when environment variable OCI_USE_NAME_AS_IDENTIFIER is set)
  oci_container_instances_container:
    # required
    display_name: display_name_example
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"

    # optional
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}

Return Values

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

Key Returned Description
container
complex
on success
Details of the Container resource acted upon by the current operation

Sample:
{'additional_capabilities': [], 'arguments': [], 'availability_domain': 'Uocm:PHX-AD-1', 'command': [], 'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'container_instance_id': 'ocid1.containerinstance.oc1..xxxxxxEXAMPLExxxxxx', 'container_restart_attempt_count': 56, 'defined_tags': {'Operations': {'CostCenter': 'US'}}, 'display_name': 'display_name_example', 'environment_variables': {}, 'exit_code': 56, 'fault_domain': 'FAULT-DOMAIN-1', 'freeform_tags': {'Department': 'Finance'}, 'health_checks': [{'command': [], 'failure_action': 'KILL', 'failure_threshold': 56, 'headers': [{'name': 'name_example', 'value': 'value_example'}], 'health_check_type': 'HTTP', 'initial_delay_in_seconds': 56, 'interval_in_seconds': 56, 'name': 'name_example', 'path': 'path_example', 'port': 56, 'status': 'HEALTHY', 'status_details': 'status_details_example', 'success_threshold': 56, 'timeout_in_seconds': 56}], 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'image_url': 'image_url_example', 'is_resource_principal_disabled': True, 'lifecycle_details': 'lifecycle_details_example', 'lifecycle_state': 'CREATING', 'resource_config': {'memory_limit_in_gbs': 3.4, 'vcpus_limit': 3.4}, 'system_tags': {}, 'time_created': '2013-10-20T19:20:30+01:00', 'time_terminated': '2013-10-20T19:20:30+01:00', 'time_updated': '2013-10-20T19:20:30+01:00', 'volume_mounts': [{'is_read_only': True, 'mount_path': 'mount_path_example', 'partition': 56, 'sub_path': 'sub_path_example', 'volume_name': 'volume_name_example'}], 'working_directory': 'working_directory_example'}
 
additional_capabilities
list / elements=string
on success
A list of additional configurable container capabilities

 
arguments
list / elements=string
on success
A list of string arguments for a Container's entrypoint process.
Many containers use an entrypoint process pointing to a shell, for example /bin/bash. For such containers, this argument list can also be used to specify the main command in the container process.

 
availability_domain
string
on success
Availability Domain where the Container's Instance is running.

Sample:
Uocm:PHX-AD-1
 
command
list / elements=string
on success
This command will override the container's entrypoint process. If not specified, the existing entrypoint process defined in the image will be used.

 
compartment_id
string
on success
Compartment Identifier

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
 
container_instance_id
string
on success
The identifier of the Container Instance on which this container is running.

Sample:
ocid1.containerinstance.oc1..xxxxxxEXAMPLExxxxxx
 
container_restart_attempt_count
integer
on success
The number of container restart attempts. A restart may be attempted after a health check failure or a container exit, based on the restart policy.

Sample:
56
 
defined_tags
dictionary
on success
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{"foo-namespace": {"bar-key": "value"}}`

Sample:
{'Operations': {'CostCenter': 'US'}}
 
display_name
string
on success
Display name for the Container. Can be renamed.

Sample:
display_name_example
 
environment_variables
dictionary
on success
A map of additional environment variables to set in the environment of the container's entrypoint process. These variables are in addition to any variables already defined in the container's image.

 
exit_code
integer
on success
The exit code of the container process if it has stopped executing.

Sample:
56
 
fault_domain
string
on success
Fault Domain where the Container's Instance is running.

Sample:
FAULT-DOMAIN-1
 
freeform_tags
dictionary
on success
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{"bar-key": "value"}`

Sample:
{'Department': 'Finance'}
 
health_checks
complex
on success
List of container health checks

   
command
list / elements=string
on success
The list of strings which will be concatenated to a single command for checking container's status.

   
failure_action
string
on success
The action will be triggered when the container health check fails. There are two types of action: KILL or NONE. The default action is KILL. If failure action is KILL, the container will be subject to the container restart policy.

Sample:
KILL
   
failure_threshold
integer
on success
Number of consecutive failures at which we consider the check failed.

Sample:
56
   
headers
complex
on success
Container health check Http's headers.

     
name
string
on success
Container Http header Key.

Sample:
name_example
     
value
string
on success
Container Http header value.

Sample:
value_example
   
health_check_type
string
on success
Container health check type.

Sample:
HTTP
   
initial_delay_in_seconds
integer
on success
The initial delay in seconds before start checking container health status.

Sample:
56
   
interval_in_seconds
integer
on success
Number of seconds between two consecutive runs for checking container health.

Sample:
56
   
name
string
on success
Health check name.

Sample:
name_example
   
path
string
on success
Container health check Http's path

Sample:
path_example
   
port
integer
on success
Container health check Http's port

Sample:
56
   
status
string
on success
Status of container

Sample:
HEALTHY
   
status_details
string
on success
A message describing the current status in more details.

Sample:
status_details_example
   
success_threshold
integer
on success
Number of consecutive successes at which we consider the check succeeded again after it was in failure state.

Sample:
56
   
timeout_in_seconds
integer
on success
Length of waiting time in seconds before marking health check failed.

Sample:
56
 
id
string
on success
Unique identifier that is immutable on creation

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
 
image_url
string
on success
The container image information. Currently only support public docker registry. Can be either image name, e.g `containerImage`, image name with version, e.g `containerImage:v1` or complete docker image Url e.g `docker.io/library/containerImage:latest`. If no registry is provided, will default the registry to public docker hub `docker.io/library`. The registry used for container image must be reachable over the Container Instance's VNIC.

Sample:
image_url_example
 
is_resource_principal_disabled
boolean
on success
Determines if the Container will have access to the Container Instance Resource Principal. This method utilizes resource principal version 2.2. Please refer to https://docs.oracle.com/en-us/iaas/Content/API/Concepts/sdk_authentication_methods.htm#sdk_authentication_methods_resource_principal for detailed explanation of how to leverage the exposed resource principal elements.

Sample:
True
 
lifecycle_details
string
on success
A message describing the current state in more detail. For example, can be used to provide actionable information for a resource in Failed state.

Sample:
lifecycle_details_example
 
lifecycle_state
string
on success
The current state of the Container.

Sample:
CREATING
 
resource_config
complex
on success

   
memory_limit_in_gbs
float
on success
The maximum amount of memory which may be consumed by the Container's process. If no value is provided, then the process may use all available memory on the Instance.

Sample:
3.4
   
vcpus_limit
float
on success
The maximum amount of CPU utilization which may be consumed by the Container's process. If no value is provided, then the process may consume all CPU resources on the Instance. CPU usage is defined in terms of logical CPUs. This means that the maximum possible value on an E3 ContainerInstance with 1 OCPU is 2.0.

Sample:
3.4
 
system_tags
dictionary
on success
Usage of system tag keys. These predefined keys are scoped to namespaces. Example: `{"orcl-cloud": {"free-tier-retained": "true"}}`

 
time_created
string
on success
The time the the Container was created. An RFC3339 formatted datetime string

Sample:
2013-10-20T19:20:30+01:00
 
time_terminated
string
on success
Time at which the container last terminated. An RFC3339 formatted datetime string

Sample:
2013-10-20T19:20:30+01:00
 
time_updated
string
on success
The time the Container was updated. An RFC3339 formatted datetime string

Sample:
2013-10-20T19:20:30+01:00
 
volume_mounts
complex
on success
List of the volume mounts.

   
is_read_only
boolean
on success
Whether the volume was mounted in read-only mode. Defaults to false if not specified.

Sample:
True
   
mount_path
string
on success
mountPath describes the volume access path.

Sample:
mount_path_example
   
partition
integer
on success
If there is more than 1 partitions in the volume, this is the number of partition which be referenced. Here is a example: Number Start End Size File system Name Flags 1 1049kB 106MB 105MB fat16 EFI System Partition boot, esp 2 106MB 1180MB 1074MB xfs 3 1180MB 50.0GB 48.8GB lvm

Sample:
56
   
sub_path
string
on success
specifies a sub-path inside the referenced volume instead of its root

Sample:
sub_path_example
   
volume_name
string
on success
The name of the volume.

Sample:
volume_name_example
 
working_directory
string
on success
The working directory within the Container's filesystem for the Container process. If this is not present, the default working directory from the image will be used.

Sample:
working_directory_example


Authors

  • Oracle (@oracle)