oracle.oci.oci_os_management_hub_scheduled_job_actions – Perform actions on a ScheduledJob resource in Oracle Cloud Infrastructure¶
Note
This plugin is part of the oracle.oci collection (version 5.5.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_os_management_hub_scheduled_job_actions
.
New in version 2.9.0: of oracle.oci
Synopsis¶
Perform actions on a ScheduledJob resource in Oracle Cloud Infrastructure
For action=change_compartment, moves a scheduled job to another compartment.
For action=run_scheduled_job_now, triggers an already created recurring scheduled job to run immediately instead of waiting for its next regularly scheduled time. This operation only applies to recurring jobs, not one-time scheduled jobs.
Requirements¶
The below requirements are needed on the host that executes this module.
python >= 3.6
Python SDK for Oracle Cloud Infrastructure https://oracle-cloud-infrastructure-python-sdk.readthedocs.io
Parameters¶
Parameter | Choices/Defaults | Comments |
---|---|---|
action
string
/ required
|
|
The action to perform on the ScheduledJob.
|
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
|
|
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
|
|
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 OCID of the compartment to move the scheduled job to.
Required for action=change_compartment.
|
|
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 . |
|
realm_specific_endpoint_template_enabled
boolean
|
|
Enable/Disable realm specific endpoint template for service client. By Default, realm specific endpoint template is disabled. If not set, then the value of the OCI_REALM_SPECIFIC_SERVICE_ENDPOINT_TEMPLATE_ENABLED variable, if any, is used.
|
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_job_id
string
/ required
|
The OCID of the scheduled job.
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 |
Notes¶
Note
For OCI python sdk configuration, please refer to https://oracle-cloud-infrastructure-python-sdk.readthedocs.io/en/latest/configuration.html
Examples¶
- name: Perform action change_compartment on scheduled_job
oci_os_management_hub_scheduled_job_actions:
# required
compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
scheduled_job_id: "ocid1.scheduledjob.oc1..xxxxxxEXAMPLExxxxxx"
action: change_compartment
- name: Perform action run_scheduled_job_now on scheduled_job
oci_os_management_hub_scheduled_job_actions:
# required
scheduled_job_id: "ocid1.scheduledjob.oc1..xxxxxxEXAMPLExxxxxx"
action: run_scheduled_job_now
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description | ||||
---|---|---|---|---|---|---|
scheduled_job
complex
|
on success |
Details of the ScheduledJob resource acted upon by the current operation
Sample:
{'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'defined_tags': {'Operations': {'CostCenter': 'US'}}, 'description': 'description_example', 'display_name': 'display_name_example', 'freeform_tags': {'Department': 'Finance'}, 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'is_managed_by_autonomous_linux': True, 'is_restricted': True, 'is_subcompartment_included': True, 'lifecycle_stage_ids': [], 'lifecycle_state': 'CREATING', 'locations': [], 'managed_compartment_ids': [], 'managed_instance_group_ids': [], 'managed_instance_ids': [], 'operations': [{'manage_module_streams_details': {'disable': [{'module_name': 'module_name_example', 'software_source_id': 'ocid1.softwaresource.oc1..xxxxxxEXAMPLExxxxxx', 'stream_name': 'stream_name_example'}], 'enable': [{'module_name': 'module_name_example', 'software_source_id': 'ocid1.softwaresource.oc1..xxxxxxEXAMPLExxxxxx', 'stream_name': 'stream_name_example'}], 'install': [{'module_name': 'module_name_example', 'profile_name': 'profile_name_example', 'software_source_id': 'ocid1.softwaresource.oc1..xxxxxxEXAMPLExxxxxx', 'stream_name': 'stream_name_example'}], 'remove': [{'module_name': 'module_name_example', 'profile_name': 'profile_name_example', 'software_source_id': 'ocid1.softwaresource.oc1..xxxxxxEXAMPLExxxxxx', 'stream_name': 'stream_name_example'}]}, 'operation_type': 'INSTALL_PACKAGES', 'package_names': [], 'software_source_ids': [], 'switch_module_streams_details': {'module_name': 'module_name_example', 'software_source_id': 'ocid1.softwaresource.oc1..xxxxxxEXAMPLExxxxxx', 'stream_name': 'stream_name_example'}, 'windows_update_names': []}], 'recurring_rule': 'recurring_rule_example', 'retry_intervals': [], 'schedule_type': 'ONETIME', 'system_tags': {}, 'time_created': '2013-10-20T19:20:30+01:00', 'time_last_execution': '2013-10-20T19:20:30+01:00', 'time_next_execution': '2013-10-20T19:20:30+01:00', 'time_updated': '2013-10-20T19:20:30+01:00', 'work_request_ids': []}
|
||||
compartment_id
string
|
on success |
The OCID of the compartment that contains the scheduled job.
Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
|
||||
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'}}
|
||||
description
string
|
on success |
User-specified description for the scheduled job.
Sample:
description_example
|
||||
display_name
string
|
on success |
User-friendly name for the scheduled job.
Sample:
display_name_example
|
||||
freeform_tags
dictionary
|
on success |
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 Resource Tags. Example: `{"Department": "Finance"}`
Sample:
{'Department': 'Finance'}
|
||||
id
string
|
on success |
The OCID of the scheduled job.
Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
|
||||
is_managed_by_autonomous_linux
boolean
|
on success |
Indicates whether this scheduled job is managed by the Autonomous Linux service.
Sample:
True
|
||||
is_restricted
boolean
|
on success |
Indicates if the schedule job has restricted update and deletion capabilities. For restricted scheduled jobs, you can update only the timeNextExecution, recurringRule, and tags.
Sample:
True
|
||||
is_subcompartment_included
boolean
|
on success |
Indicates whether to apply the scheduled job to all compartments in the tenancy when managedCompartmentIds specifies the tenancy OCID (root compartment).
Sample:
True
|
||||
lifecycle_stage_ids
list
/ elements=string
|
on success |
The lifecycle stage OCIDs that this scheduled job operates on. A scheduled job can only operate on one type of target, therefore this parameter is mutually exclusive with managedInstanceIds, managedInstanceGroupIds, and managedCompartmentIds.
|
||||
lifecycle_state
string
|
on success |
The current state of the scheduled job.
Sample:
CREATING
|
||||
locations
list
/ elements=string
|
on success |
The list of locations this scheduled job should operate on for a job targeting on compartments. (Empty list means apply to all locations). This can only be set when managedCompartmentIds is not empty.
|
||||
managed_compartment_ids
list
/ elements=string
|
on success |
The compartment OCIDs that this scheduled job operates on. A scheduled job can only operate on one type of target, therefore this parameter is mutually exclusive with managedInstanceIds, managedInstanceGroupIds, and lifecycleStageIds.
|
||||
managed_instance_group_ids
list
/ elements=string
|
on success |
The managed instance group OCIDs that this scheduled job operates on. A scheduled job can only operate on one type of target, therefore this parameter is mutually exclusive with managedInstanceIds, managedCompartmentIds, and lifecycleStageIds.
|
||||
managed_instance_ids
list
/ elements=string
|
on success |
The managed instance OCIDs that this scheduled job operates on. A scheduled job can only operate on one type of target, therefore this parameter is mutually exclusive with managedInstanceGroupIds, managedCompartmentIds, and lifecycleStageIds.
|
||||
operations
complex
|
on success |
The list of operations this scheduled job needs to perform. A scheduled job supports only one operation type, unless it is one of the following: * UPDATE_PACKAGES * UPDATE_ALL * UPDATE_SECURITY * UPDATE_BUGFIX * UPDATE_ENHANCEMENT * UPDATE_OTHER * UPDATE_KSPLICE_USERSPACE * UPDATE_KSPLICE_KERNEL
|
||||
manage_module_streams_details
complex
|
on success |
|
||||
disable
complex
|
on success |
The set of module streams to disable.
|
||||
module_name
string
|
on success |
The name of a module.
Sample:
module_name_example
|
||||
software_source_id
string
|
on success |
The OCID of the software source that contains the module stream.
Sample:
ocid1.softwaresource.oc1..xxxxxxEXAMPLExxxxxx
|
||||
stream_name
string
|
on success |
The name of a stream of the specified module.
Sample:
stream_name_example
|
||||
enable
complex
|
on success |
The set of module streams to enable.
|
||||
module_name
string
|
on success |
The name of a module.
Sample:
module_name_example
|
||||
software_source_id
string
|
on success |
The OCID of the software source that contains the module stream.
Sample:
ocid1.softwaresource.oc1..xxxxxxEXAMPLExxxxxx
|
||||
stream_name
string
|
on success |
The name of a stream of the specified module.
Sample:
stream_name_example
|
||||
install
complex
|
on success |
The set of module stream profiles to install.
|
||||
module_name
string
|
on success |
The name of a module.
Sample:
module_name_example
|
||||
profile_name
string
|
on success |
The name of a profile of the specified module stream.
Sample:
profile_name_example
|
||||
software_source_id
string
|
on success |
The OCID of the software source that contains the module stream.
Sample:
ocid1.softwaresource.oc1..xxxxxxEXAMPLExxxxxx
|
||||
stream_name
string
|
on success |
The name of a stream of the specified module.
Sample:
stream_name_example
|
||||
remove
complex
|
on success |
The set of module stream profiles to remove.
|
||||
module_name
string
|
on success |
The name of a module.
Sample:
module_name_example
|
||||
profile_name
string
|
on success |
The name of a profile of the specified module stream.
Sample:
profile_name_example
|
||||
software_source_id
string
|
on success |
The OCID of the software source that contains the module stream.
Sample:
ocid1.softwaresource.oc1..xxxxxxEXAMPLExxxxxx
|
||||
stream_name
string
|
on success |
The name of a stream of the specified module.
Sample:
stream_name_example
|
||||
operation_type
string
|
on success |
The type of operation this scheduled job performs.
Sample:
INSTALL_PACKAGES
|
||||
package_names
list
/ elements=string
|
on success |
The names of the target packages. This parameter only applies when the scheduled job is for installing, updating, or removing packages.
|
||||
software_source_ids
list
/ elements=string
|
on success |
The software source OCIDs. This parameter only applies when the scheduled job is for attaching or detaching software sources.
|
||||
switch_module_streams_details
complex
|
on success |
|
||||
module_name
string
|
on success |
The name of a module.
Sample:
module_name_example
|
||||
software_source_id
string
|
on success |
The OCID of the software source that contains the module stream.
Sample:
ocid1.softwaresource.oc1..xxxxxxEXAMPLExxxxxx
|
||||
stream_name
string
|
on success |
The name of a stream of the specified module.
Sample:
stream_name_example
|
||||
windows_update_names
list
/ elements=string
|
on success |
Unique identifier for the Windows update. This parameter only applies if the scheduled job is for installing Windows updates. Note that this is not an OCID, but is a unique identifier assigned by Microsoft. For example: '6981d463-cd91-4a26-b7c4-ea4ded9183ed'.
|
||||
recurring_rule
string
|
on success |
The frequency schedule for a recurring scheduled job.
Sample:
recurring_rule_example
|
||||
retry_intervals
list
/ elements=string
|
on success |
The amount of time in minutes to wait until retrying the scheduled job. If set, the service will automatically retry a failed scheduled job after the interval. For example, you could set the interval to [2,5,10]. If the initial execution of the job fails, the service waits 2 minutes and then retries. If that fails, the service waits 5 minutes and then retries. If that fails, the service waits 10 minutes and then retries.
|
||||
schedule_type
string
|
on success |
The type of scheduling frequency for the job.
Sample:
ONETIME
|
||||
system_tags
dictionary
|
on success |
System tags for this resource. Each key is predefined and scoped to a namespace. Example: `{"orcl-cloud": {"free-tier-retained": "true"}}`
|
||||
time_created
string
|
on success |
The time this scheduled job was created (in RFC 3339 format).
Sample:
2013-10-20T19:20:30+01:00
|
||||
time_last_execution
string
|
on success |
The time of the last execution of this scheduled job (in RFC 3339 format).
Sample:
2013-10-20T19:20:30+01:00
|
||||
time_next_execution
string
|
on success |
The time of the next execution of this scheduled job (in RFC 3339 format).
Sample:
2013-10-20T19:20:30+01:00
|
||||
time_updated
string
|
on success |
The time this scheduled job was updated (in RFC 3339 format).
Sample:
2013-10-20T19:20:30+01:00
|
||||
work_request_ids
list
/ elements=string
|
on success |
The list of work request OCIDs associated with this scheduled job.
|
Authors¶
Oracle (@oracle)