oracle.oci.oci_resource_manager_job_facts – Fetches details about one or multiple Job resources in Oracle Cloud Infrastructure

Note

This plugin is part of the oracle.oci collection (version 4.11.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_resource_manager_job_facts.

New in version 2.9.0: of oracle.oci

Synopsis

  • Fetches details about one or multiple Job resources in Oracle Cloud Infrastructure

  • Lists jobs according to the specified filter. By default, the list is ordered by time created.

    • To list all jobs in a stack, provide the stack OCID. - To list all jobs in a compartment, provide the compartment OCID. - To return a specific job, provide the job OCID. (Equivalent to GetStack.)

  • If job_id is specified, the details of a single Job will be returned.

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
A filter to return only resources that exist in the compartment, identified by OCID.
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.
display_name
string
A filter to return only resources that match the given display name exactly. Use this filter to list a resource by name. Requires `sortBy` set to `DISPLAYNAME`. Alternatively, when you know the resource OCID, use the related Get operation.

aliases: name
job_id
string
The OCID of the job.
Required to get a specific job.

aliases: id
lifecycle_state
string
    Choices:
  • ACCEPTED
  • IN_PROGRESS
  • FAILED
  • SUCCEEDED
  • CANCELING
  • CANCELED
A filter that returns all resources that match the specified lifecycle state. The state value is case-insensitive.
Allowable values: - ACCEPTED - IN_PROGRESS - FAILED - SUCCEEDED - CANCELING - CANCELED
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.
sort_by
string
    Choices:
  • TIMECREATED
  • DISPLAYNAME
The field to use when sorting returned resources. By default, `TIMECREATED` is ordered descending. By default, `DISPLAYNAME` is ordered ascending. Note that you can sort only on one field.
sort_order
string
    Choices:
  • ASC
  • DESC
The sort order to use when sorting returned resources. Ascending (`ASC`) or descending (`DESC`).
stack_id
string
The stack OCID on which to filter.
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

Examples

- name: Get a specific job
  oci_resource_manager_job_facts:
    # required
    job_id: "ocid1.job.oc1..xxxxxxEXAMPLExxxxxx"

- name: List jobs
  oci_resource_manager_job_facts:

    # optional
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    stack_id: "ocid1.stack.oc1..xxxxxxEXAMPLExxxxxx"
    lifecycle_state: ACCEPTED
    display_name: display_name_example
    sort_by: TIMECREATED
    sort_order: ASC

Return Values

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

Key Returned Description
jobs
complex
on success
List of Job resources

Sample:
[{'apply_job_plan_resolution': {'is_auto_approved': True, 'is_use_latest_job_id': True, 'plan_job_id': 'ocid1.planjob.oc1..xxxxxxEXAMPLExxxxxx'}, 'cancellation_details': {'is_forced': True}, 'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'config_source': {'branch_name': 'branch_name_example', 'bucket_name': 'bucket_name_example', 'commit_id': 'ocid1.commit.oc1..xxxxxxEXAMPLExxxxxx', 'config_source_record_type': 'COMPARTMENT_CONFIG_SOURCE', 'configuration_source_provider_id': 'ocid1.configurationsourceprovider.oc1..xxxxxxEXAMPLExxxxxx', 'namespace': 'namespace_example', 'region': 'us-phoenix-1', 'repository_url': 'repository_url_example'}, 'defined_tags': {'Operations': {'CostCenter': 'US'}}, 'display_name': 'display_name_example', 'failure_details': {'code': 'INTERNAL_SERVICE_ERROR', 'message': 'message_example'}, 'freeform_tags': {'Department': 'Finance'}, 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'is_provider_upgrade_required': True, 'is_third_party_provider_experience_enabled': True, 'job_operation_details': {'execution_plan_job_id': 'ocid1.executionplanjob.oc1..xxxxxxEXAMPLExxxxxx', 'execution_plan_rollback_job_id': 'ocid1.executionplanrollbackjob.oc1..xxxxxxEXAMPLExxxxxx', 'execution_plan_rollback_strategy': 'FROM_PLAN_ROLLBACK_JOB_ID', 'execution_plan_strategy': 'FROM_PLAN_JOB_ID', 'operation': 'APPLY', 'target_rollback_job_id': 'ocid1.targetrollbackjob.oc1..xxxxxxEXAMPLExxxxxx', 'terraform_advanced_options': {'detailed_log_level': 'ERROR', 'is_refresh_required': True, 'parallelism': 56}}, 'lifecycle_state': 'ACCEPTED', 'operation': 'PLAN', 'resolved_plan_job_id': 'ocid1.resolvedplanjob.oc1..xxxxxxEXAMPLExxxxxx', 'stack_id': 'ocid1.stack.oc1..xxxxxxEXAMPLExxxxxx', 'time_created': '2013-10-20T19:20:30+01:00', 'time_finished': '2013-10-20T19:20:30+01:00', 'variables': {}, 'working_directory': 'working_directory_example'}]
 
apply_job_plan_resolution
complex
on success

   
is_auto_approved
boolean
on success
Specifies whether to use the configuration directly, without reference to a Plan job. `True` if using the configuration directly. Note that it is not necessary for a Plan job to have run successfully.

Sample:
True
   
is_use_latest_job_id
boolean
on success
Specifies whether to use the OCID of the most recently run plan job. `True` if using the latest job OCID. Must be a plan job that completed successfully.

Sample:
True
   
plan_job_id
string
on success
The OCID that specifies the most recently executed plan job.

Sample:
ocid1.planjob.oc1..xxxxxxEXAMPLExxxxxx
 
cancellation_details
complex
on success
Returned for get operation

   
is_forced
boolean
on success
Indicates whether a forced cancellation was requested for the job while it was running. A forced cancellation can result in an incorrect state file. For example, the state file might not reflect the exact state of the provisioned resources.

Sample:
True
 
compartment_id
string
on success
The OCID of the compartment in which the job's associated stack resides.

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
 
config_source
complex
on success
Returned for get operation

   
branch_name
string
on success
The name of the branch within the Git repository.

Sample:
branch_name_example
   
bucket_name
string
on success
The name of the bucket that contains the Terraform configuration files.

Sample:
bucket_name_example
   
commit_id
string
on success
The unique identifier (SHA-1 hash) of the individual change to the Git repository.

Sample:
ocid1.commit.oc1..xxxxxxEXAMPLExxxxxx
   
config_source_record_type
string
on success
The type of configuration source to use for the Terraform configuration.

Sample:
COMPARTMENT_CONFIG_SOURCE
   
configuration_source_provider_id
string
on success
Unique identifier (OCID) for the Git configuration source.

Sample:
ocid1.configurationsourceprovider.oc1..xxxxxxEXAMPLExxxxxx
   
namespace
string
on success
The Object Storage namespace that contains the bucket.

Sample:
namespace_example
   
region
string
on success
The name of the bucket's region. Example: `us-phoenix-1`

Sample:
us-phoenix-1
   
repository_url
string
on success
The URL of the Git repository.

Sample:
repository_url_example
 
defined_tags
dictionary
on success
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: `{"Operations": {"CostCenter": "42"}}`

Sample:
{'Operations': {'CostCenter': 'US'}}
 
display_name
string
on success
The job's display name.

Sample:
display_name_example
 
failure_details
complex
on success
Returned for get operation

   
code
string
on success
Job failure reason.

Sample:
INTERNAL_SERVICE_ERROR
   
message
string
on success
A human-readable error string.

Sample:
message_example
 
freeform_tags
dictionary
on success
Free-form tags associated with this resource. Each tag is a key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: `{"Department": "Finance"}`

Sample:
{'Department': 'Finance'}
 
id
string
on success
The OCID of the job.

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
 
is_provider_upgrade_required
boolean
on success
Specifies whether or not to upgrade provider versions. Within the version constraints of your Terraform configuration, use the latest versions available from the source of Terraform providers. For more information about this option, see L(Dependency Lock File (terraform.io),https://www.terraform.io/language/files/dependency-lock).
Returned for get operation

Sample:
True
 
is_third_party_provider_experience_enabled
boolean
on success
When `true`, the stack sources third-party Terraform providers from Terraform Registry and allows custom providers. For more information about stack sourcing of third-party Terraform providers, see Third-party Provider Configuration.
Returned for get operation

Sample:
True
 
job_operation_details
complex
on success

   
execution_plan_job_id
string
on success
The OCID of the plan job that contains the execution plan used for this job, or `null` if no execution plan was used.

Sample:
ocid1.executionplanjob.oc1..xxxxxxEXAMPLExxxxxx
   
execution_plan_rollback_job_id
string
on success
The OCID of a plan rollback job, for use when specifying `"FROM_PLAN_ROLLBACK_JOB_ID"` as the `executionPlanRollbackStrategy`.

Sample:
ocid1.executionplanrollbackjob.oc1..xxxxxxEXAMPLExxxxxx
   
execution_plan_rollback_strategy
string
on success
Specifies the source of the execution plan for rollback to apply. Use `AUTO_APPROVED` to run the job without an execution plan for rollback.

Sample:
FROM_PLAN_ROLLBACK_JOB_ID
   
execution_plan_strategy
string
on success
Specifies the source of the execution plan to apply. Use `AUTO_APPROVED` to run the job without an execution plan.

Sample:
FROM_PLAN_JOB_ID
   
operation
string
on success
Terraform-specific operation to execute.

Sample:
APPLY
   
target_rollback_job_id
string
on success
The OCID of a successful apply job, for use when specifying `"AUTO_APPROVED"` as the `executionPlanRollbackStrategy`.

Sample:
ocid1.targetrollbackjob.oc1..xxxxxxEXAMPLExxxxxx
   
terraform_advanced_options
complex
on success

     
detailed_log_level
string
on success
Enables detailed logs at the specified verbosity for running the job (operation).

Sample:
ERROR
     
is_refresh_required
boolean
on success
Specifies whether to refresh the state for each resource before running the job (operation). Refreshing the state can affect performance. Consider setting to `false` if the configuration includes several resources. Used with the following operations: `PLAN`, `APPLY`, `DESTROY`.

Sample:
True
     
parallelism
integer
on success
Limits the number of concurrent Terraform operations when walking the graph. Use this parameter to help debug Terraform issues or to accomplish certain special use cases. A higher value might cause resources to be throttled. Used with the following operations: `PLAN`, `APPLY`, `DESTROY`.

Sample:
56
 
lifecycle_state
string
on success
Current state of the specified job. For more information about job lifecycle states in Resource Manager, see Key Concepts.

Sample:
ACCEPTED
 
operation
string
on success
The type of job executing.

Sample:
PLAN
 
resolved_plan_job_id
string
on success
Deprecated. Use the property `executionPlanJobId` in `jobOperationDetails` instead. The plan job OCID that was used (if this was an apply job and was not auto-approved).

Sample:
ocid1.resolvedplanjob.oc1..xxxxxxEXAMPLExxxxxx
 
stack_id
string
on success
The OCID of the stack that is associated with the job.

Sample:
ocid1.stack.oc1..xxxxxxEXAMPLExxxxxx
 
time_created
string
on success
The date and time when the job was created. Format is defined by RFC3339. Example: `2020-01-25T21:10:29.600Z`

Sample:
2013-10-20T19:20:30+01:00
 
time_finished
string
on success
The date and time when the job stopped running, irrespective of whether the job ran successfully. Format is defined by RFC3339. Example: `2020-01-25T21:10:29.600Z`

Sample:
2013-10-20T19:20:30+01:00
 
variables
dictionary
on success
Terraform variables associated with this resource. Maximum number of variables supported is 250. The maximum size of each variable, including both name and value, is 8192 bytes. Example: `{"CompartmentId": "compartment-id-value"}`
Returned for get operation

 
working_directory
string
on success
File path to the directory to use for running Terraform. If not specified, the root directory is used. Required when using a zip Terraform configuration (`configSourceType` value of `ZIP_UPLOAD`) that contains folders. Ignored for the `configSourceType` value of `COMPARTMENT_CONFIG_SOURCE`. For more information about required and recommended file structure, see L(File Structure (Terraform Configurations for Resource Manager),https://docs.cloud.oracle.com/iaas/Content/ResourceManager/Concepts/terraformconfigresourcemanager.htm#filestructure).
Returned for get operation

Sample:
working_directory_example


Authors

  • Oracle (@oracle)