oracle.oci.oci_log_analytics_scheduled_task_actions – Perform actions on a ScheduledTask resource 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_log_analytics_scheduled_task_actions.

New in version 2.9.0: of oracle.oci

Synopsis

  • Perform actions on a ScheduledTask resource in Oracle Cloud Infrastructure

  • For action=change_compartment, move the scheduled task into a different compartment within the same tenancy.

Requirements

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

Parameters

Parameter Choices/Defaults Comments
action
string / required
    Choices:
  • change_compartment
The action to perform on the ScheduledTask.
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 / required
Compartment Identifier 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.
namespace_name
string / required
The Logging Analytics namespace used for the request.
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.
scheduled_task_id
string / required
Unique scheduledTask id returned from task create. If invalid will lead to a 404 not found.

aliases: id
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: Perform action change_compartment on scheduled_task
  oci_log_analytics_scheduled_task_actions:
    # required
    namespace_name: namespace_name_example
    scheduled_task_id: "ocid1.scheduledtask.oc1..xxxxxxEXAMPLExxxxxx"
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    action: change_compartment

Return Values

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

Key Returned Description
scheduled_task
complex
on success
Details of the ScheduledTask resource acted upon by the current operation

Sample:
{'action': {'compartment_id_in_subtree': True, 'data_type': 'LOG', 'metric_extraction': {'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'metric_name': 'metric_name_example', 'namespace': 'namespace_example', 'resource_group': 'resource_group_example'}, 'purge_compartment_id': 'ocid1.purgecompartment.oc1..xxxxxxEXAMPLExxxxxx', 'purge_duration': 'purge_duration_example', 'query_string': 'query_string_example', 'saved_search_duration': 'saved_search_duration_example', 'saved_search_id': 'ocid1.savedsearch.oc1..xxxxxxEXAMPLExxxxxx', 'type': 'STREAM'}, 'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'defined_tags': {'Operations': {'CostCenter': 'US'}}, 'display_name': 'display_name_example', 'freeform_tags': {'Department': 'Finance'}, 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'kind': 'ACCELERATION', 'last_execution_status': 'FAILED', 'lifecycle_state': 'ACTIVE', 'num_occurrences': 56, 'pause_reason': 'METRIC_EXTRACTION_NOT_VALID', 'schedules': [{'expression': 'expression_example', 'misfire_policy': 'RETRY_ONCE', 'recurring_interval': 'recurring_interval_example', 'repeat_count': 56, 'time_of_first_execution': '2013-10-20T19:20:30+01:00', 'time_zone': 'time_zone_example', 'type': 'FIXED_FREQUENCY'}], 'task_status': 'READY', 'task_type': 'SAVED_SEARCH', 'time_created': '2013-10-20T19:20:30+01:00', 'time_last_executed': '2013-10-20T19:20:30+01:00', 'time_of_next_execution': '2013-10-20T19:20:30+01:00', 'time_updated': '2013-10-20T19:20:30+01:00', 'work_request_id': 'ocid1.workrequest.oc1..xxxxxxEXAMPLExxxxxx'}
 
action
complex
on success

   
compartment_id_in_subtree
boolean
on success
if true, purge child compartments data

Sample:
True
   
data_type
string
on success
the type of the log data to be purged

Sample:
LOG
   
metric_extraction
complex
on success

     
compartment_id
string
on success
The compartment OCID (/iaas/Content/General/Concepts/identifiers.htm) of the extracted metric.

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
     
metric_name
string
on success
The metric name of the extracted metric. A valid value starts with an alphabetical character and includes only alphanumeric characters, periods (.), underscores (_), hyphens (-), and dollar signs ($).

Sample:
metric_name_example
     
namespace
string
on success
The namespace of the extracted metric. A valid value starts with an alphabetical character and includes only alphanumeric characters and underscores (_).

Sample:
namespace_example
     
resource_group
string
on success
The resourceGroup of the extracted metric. A valid value starts with an alphabetical character and includes only alphanumeric characters, periods (.), underscores (_), hyphens (-), and dollar signs ($).

Sample:
resource_group_example
   
purge_compartment_id
string
on success
the compartment OCID under which the data will be purged

Sample:
ocid1.purgecompartment.oc1..xxxxxxEXAMPLExxxxxx
   
purge_duration
string
on success
The duration of data to be retained, which is used to calculate the timeDataEnded when the task fires. The value should be negative. Purge duration in ISO 8601 extended format as described in https://en.wikipedia.org/wiki/ISO_8601#Durations. The largest supported unit is D, e.g. -P365D (not -P1Y) or -P14D (not -P2W).

Sample:
purge_duration_example
   
query_string
string
on success
Purge query string.

Sample:
query_string_example
   
saved_search_duration
string
on success
The duration of data to be searched for SAVED_SEARCH tasks, used when the task fires to calculate the query time range.
Duration in ISO 8601 extended format as described in https://en.wikipedia.org/wiki/ISO_8601#Durations. The value should be positive. The largest supported unit (as opposed to value) is D, e.g. P14D (not P2W).
There are restrictions on the maximum duration value relative to the task schedule value as specified in the following table. Schedule Interval Range | Maximum Duration ----------------------------------- | ----------------- 5 Minutes to 30 Minutes | 1 hour "PT60M" 31 Minutes to 1 Hour | 12 hours "PT720M" 1 Hour+1Minute to 1 Day | 1 day "P1D" 1 Day+1Minute to 1 Week-1Minute | 7 days "P7D" 1 Week to 2 Weeks | 14 days "P14D" greater than 2 Weeks | 30 days "P30D"
If not specified, the duration will be based on the schedule. For example, if the schedule is every 5 minutes then the savedSearchDuration will be "PT5M"; if the schedule is every 3 weeks then the savedSearchDuration will be "P21D".

Sample:
saved_search_duration_example
   
saved_search_id
string
on success
The ManagementSavedSearch id [OCID] utilized in the action.

Sample:
ocid1.savedsearch.oc1..xxxxxxEXAMPLExxxxxx
   
type
string
on success
Action type discriminator.

Sample:
STREAM
 
compartment_id
string
on success
Compartment Identifier OCID].

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
 
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
A user-friendly name that is changeable and that does not have to be unique. Format: a leading alphanumeric, followed by zero or more alphanumerics, underscores, spaces, backslashes, or hyphens in any order). No trailing spaces allowed.

Sample:
display_name_example
 
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'}
 
id
string
on success
The OCID of the data plane resource.

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
 
kind
string
on success
Discriminator.

Sample:
ACCELERATION
 
last_execution_status
string
on success
The most recent task execution status.

Sample:
FAILED
 
lifecycle_state
string
on success
The current state of the scheduled task.

Sample:
ACTIVE
 
num_occurrences
integer
on success
Number of execution occurrences.

Sample:
56
 
pause_reason
string
on success
reason for taskStatus PAUSED.

Sample:
METRIC_EXTRACTION_NOT_VALID
 
schedules
complex
on success
Schedules.

   
expression
string
on success
Value in cron format.

Sample:
expression_example
   
misfire_policy
string
on success
Schedule misfire retry policy.

Sample:
RETRY_ONCE
   
recurring_interval
string
on success
Recurring interval in ISO 8601 extended format as described in https://en.wikipedia.org/wiki/ISO_8601#Durations. The largest supported unit is D, e.g. P14D (not P2W). The value must be at least 5 minutes (PT5M) and at most 3 weeks (P21D or PT30240M).

Sample:
recurring_interval_example
   
repeat_count
integer
on success
Number of times (0-based) to execute until auto-stop. Default value -1 will execute indefinitely. Value 0 will execute once.

Sample:
56
   
time_of_first_execution
string
on success
The date and time the scheduled task should execute first time after create or update; thereafter the task will execute as specified in the schedule.

Sample:
2013-10-20T19:20:30+01:00
   
time_zone
string
on success
Time zone, by default UTC.

Sample:
time_zone_example
   
type
string
on success
Schedule type discriminator.

Sample:
FIXED_FREQUENCY
 
task_status
string
on success
Status of the scheduled task.

Sample:
READY
 
task_type
string
on success
Task type.

Sample:
SAVED_SEARCH
 
time_created
string
on success
The date and time the scheduled task was created, in the format defined by RFC3339.

Sample:
2013-10-20T19:20:30+01:00
 
time_last_executed
string
on success
The date and time the scheduled task last executed, in the format defined by RFC3339.

Sample:
2013-10-20T19:20:30+01:00
 
time_of_next_execution
string
on success
The date and time the scheduled task will execute next, in the format defined by RFC3339.

Sample:
2013-10-20T19:20:30+01:00
 
time_updated
string
on success
The date and time the scheduled task was last updated, in the format defined by RFC3339.

Sample:
2013-10-20T19:20:30+01:00
 
work_request_id
string
on success
most recent Work Request Identifier OCID] for the asynchronous request.

Sample:
ocid1.workrequest.oc1..xxxxxxEXAMPLExxxxxx


Authors

  • Oracle (@oracle)