oracle.oci.oci_usage_schedule – Manage a Schedule 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_usage_schedule.

New in version 2.9.0: of oracle.oci

Synopsis

  • This module allows the user to create, update and delete a Schedule resource in Oracle Cloud Infrastructure

  • For state=present, returns the created schedule.

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 customer tenancy.
Required for create using state=present.
Required for update when environment variable OCI_USE_NAME_AS_IDENTIFIER is set.
Required for delete 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.
defined_tags
dictionary
Defined tags for this resource. Each key is predefined and scoped to a namespace. See Resource Tags. Example: `{"foo-namespace": {"bar-key": "value"}}`
This parameter is updatable.
description
string
The description of the schedule.
This parameter is updatable.
force_create
boolean
    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
dictionary
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. See Resource Tags. Example: `{"bar-key": "value"}`
This parameter is updatable.
key_by
list / elements=string
The list of attributes of this resource which should be used to uniquely identify an instance of the resource. By default, all the attributes of a resource are used to uniquely identify a resource.
name
string
The unique name of the user-created schedule.
Required for create using state=present.
Required for update, delete when environment variable OCI_USE_NAME_AS_IDENTIFIER is set.
output_file_format
string
    Choices:
  • CSV
  • PDF
Specifies supported output file format.
This parameter is updatable.
query_properties
dictionary
compartment_depth
float
The depth level of the compartment.
date_range
dictionary / required
date_range_type
string / required
    Choices:
  • STATIC
  • DYNAMIC
Defines whether the schedule date range is STATIC or DYNAMIC.
dynamic_date_range_type
string
    Choices:
  • LAST_7_DAYS
  • LAST_10_DAYS
  • LAST_CALENDAR_WEEK
  • LAST_CALENDAR_MONTH
  • LAST_2_CALENDAR_MONTHS
  • LAST_3_CALENDAR_MONTHS
  • LAST_6_CALENDAR_MONTHS
  • LAST_30_DAYS
  • MONTH_TO_DATE
  • LAST_YEAR
  • YEAR_TODATE
  • ALL
Required when date_range_type is 'DYNAMIC'
time_usage_ended
string
The usage end time.
Required when date_range_type is 'STATIC'
time_usage_started
string
The usage start time.
Required when date_range_type is 'STATIC'
filter
dictionary
dimensions
list / elements=dictionary
The dimensions to filter on.
key
string / required
The dimension key.
value
string / required
The dimension value.
filters
list / elements=dictionary
The nested filter object.
dimensions
list / elements=dictionary
The dimensions to filter on.
filters
list / elements=dictionary
The nested filter object.
operator
string
    Choices:
  • AND
  • NOT
  • OR
The filter operator. Example: 'AND', 'OR', 'NOT'.
tags
list / elements=dictionary
The tags to filter on.
operator
string
    Choices:
  • AND
  • NOT
  • OR
The filter operator. Example: 'AND', 'OR', 'NOT'.
tags
list / elements=dictionary
The tags to filter on.
key
string
The tag key.
namespace
string
The tag namespace.
value
string
The tag value.
granularity
string / required
    Choices:
  • DAILY
  • MONTHLY
The usage granularity. DAILY - Daily data aggregation. MONTHLY - Monthly data aggregation. Allowed values are: DAILY MONTHLY
group_by
list / elements=string
Aggregate the result by. For example: [ "tagNamespace", "tagKey", "tagValue", "service", "skuName", "skuPartNumber", "unit", "compartmentName", "compartmentPath", "compartmentId", "platform", "region", "logicalAd", "resourceId", "tenantId", "tenantName" ]
group_by_tag
list / elements=dictionary
GroupBy a specific tagKey. Provide the tagNamespace and tagKey in the tag object. Only supports one tag in the list. For example: [ { "namespace": "oracle", "key": "createdBy" ]
key
string
The tag key.
namespace
string
The tag namespace.
value
string
The tag value.
is_aggregate_by_time
boolean
    Choices:
  • no
  • yes
Specifies whether aggregated by time. If isAggregateByTime is true, all usage or cost over the query time period will be added up.
query_type
string
    Choices:
  • USAGE
  • COST
  • USAGE_AND_COST
The query usage type. COST by default if it is missing. Usage - Query the usage data. Cost - Query the cost/billing data. Allowed values are: USAGE COST USAGE_AND_COST
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.
result_location
dictionary
Required for create using state=present.
This parameter is updatable.
bucket_name
string / required
The bucket name where usage or cost CSVs will be uploaded.
location_type
string / required
    Choices:
  • OBJECT_STORAGE
Defines the type of location where the usage or cost CSVs will be stored.
namespace
string / required
The namespace needed to determine the object storage bucket.
region
string / required
The destination Object Store Region specified by the customer.
saved_report_id
string
The saved report id which can also be used to generate query.
schedule_id
string
The schedule unique OCID.
Required for update using state=present when environment variable OCI_USE_NAME_AS_IDENTIFIER is not set.
Required for delete using state=absent when environment variable OCI_USE_NAME_AS_IDENTIFIER is not set.

aliases: id
schedule_recurrences
string
Specifies the frequency according to when the schedule will be run, in the x-obmcs-recurring-time format described in RFC 5545 section 3.3.10. Supported values are : ONE_TIME, DAILY, WEEKLY and MONTHLY.
Required for create using state=present.
state
string
    Choices:
  • present ←
  • absent
The state of the Schedule.
Use state=present to create or update a Schedule.
Use state=absent to delete a Schedule.
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
time_scheduled
string
The date and time of the first time job execution.
Required for create using state=present.
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: Create schedule
  oci_usage_schedule:
    # required
    name: name_example
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    schedule_recurrences: schedule_recurrences_example
    time_scheduled: time_scheduled_example
    result_location:
      # required
      location_type: OBJECT_STORAGE
      region: us-phoenix-1
      namespace: namespace_example
      bucket_name: bucket_name_example

    # optional
    saved_report_id: "ocid1.savedreport.oc1..xxxxxxEXAMPLExxxxxx"
    query_properties:
      # required
      granularity: DAILY
      date_range:
        # required
        time_usage_started: time_usage_started_example
        time_usage_ended: time_usage_ended_example
        date_range_type: STATIC

        # optional
      group_by: [ "group_by_example" ]
      group_by_tag:
      - # optional
        namespace: namespace_example
        key: key_example
        value: value_example
      filter:
        # optional
        operator: AND
        dimensions:
        - # required
          key: key_example
          value: value_example
        tags:
        - # optional
          namespace: namespace_example
          key: key_example
          value: value_example
        filters:
        - # optional
          operator: AND
          dimensions: [ "dimensions_example" ]
          tags: [ "tags_example" ]
          filters: [ "filters_example" ]
      compartment_depth: 3.4
      query_type: USAGE
      is_aggregate_by_time: true
    description: description_example
    output_file_format: CSV
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}

- name: Update schedule
  oci_usage_schedule:
    # required
    schedule_id: "ocid1.schedule.oc1..xxxxxxEXAMPLExxxxxx"

    # optional
    description: description_example
    output_file_format: CSV
    result_location:
      # required
      location_type: OBJECT_STORAGE
      region: us-phoenix-1
      namespace: namespace_example
      bucket_name: bucket_name_example
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}

- name: Update schedule using name (when environment variable OCI_USE_NAME_AS_IDENTIFIER is set)
  oci_usage_schedule:
    # required
    name: name_example
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"

    # optional
    description: description_example
    output_file_format: CSV
    result_location:
      # required
      location_type: OBJECT_STORAGE
      region: us-phoenix-1
      namespace: namespace_example
      bucket_name: bucket_name_example
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}

- name: Delete schedule
  oci_usage_schedule:
    # required
    schedule_id: "ocid1.schedule.oc1..xxxxxxEXAMPLExxxxxx"
    state: absent

- name: Delete schedule using name (when environment variable OCI_USE_NAME_AS_IDENTIFIER is set)
  oci_usage_schedule:
    # required
    name: name_example
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    state: absent

Return Values

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

Key Returned Description
schedule
complex
on success
Details of the Schedule resource acted upon by the current operation

Sample:
{'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'defined_tags': {'Operations': {'CostCenter': 'US'}}, 'description': 'description_example', 'freeform_tags': {'Department': 'Finance'}, 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'lifecycle_state': 'ACTIVE', 'name': 'name_example', 'output_file_format': 'CSV', 'query_properties': {'compartment_depth': 10, 'date_range': {'date_range_type': 'STATIC', 'dynamic_date_range_type': 'LAST_7_DAYS', 'time_usage_ended': '2013-10-20T19:20:30+01:00', 'time_usage_started': '2013-10-20T19:20:30+01:00'}, 'filter': {'dimensions': [{'key': 'key_example', 'value': 'value_example'}], 'filters': [{'dimensions': [], 'filters': [], 'operator': 'AND', 'tags': []}], 'operator': 'AND', 'tags': [{'key': 'key_example', 'namespace': 'namespace_example', 'value': 'value_example'}]}, 'granularity': 'DAILY', 'group_by': [], 'group_by_tag': [{'key': 'key_example', 'namespace': 'namespace_example', 'value': 'value_example'}], 'is_aggregate_by_time': True, 'query_type': 'USAGE'}, 'result_location': {'bucket_name': 'bucket_name_example', 'location_type': 'OBJECT_STORAGE', 'namespace': 'namespace_example', 'region': 'us-phoenix-1'}, 'saved_report_id': 'ocid1.savedreport.oc1..xxxxxxEXAMPLExxxxxx', 'schedule_recurrences': 'schedule_recurrences_example', 'system_tags': {}, 'time_created': '2013-10-20T19:20:30+01:00', 'time_next_run': '2013-10-20T19:20:30+01:00', 'time_scheduled': '2013-10-20T19:20:30+01:00'}
 
compartment_id
string
on success
The customer tenancy.

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
 
defined_tags
dictionary
on success
Defined tags for this resource. Each key is predefined and scoped to a namespace. See Resource Tags. Example: `{"foo-namespace": {"bar-key": "value"}}`

Sample:
{'Operations': {'CostCenter': 'US'}}
 
description
string
on success
The description of the schedule.

Sample:
description_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. See Resource Tags. Example: `{"bar-key": "value"}`

Sample:
{'Department': 'Finance'}
 
id
string
on success
The OCID representing a unique shedule.

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
 
lifecycle_state
string
on success
The schedule lifecycle state.

Sample:
ACTIVE
 
name
string
on success
The unique name of the schedule created by the user.

Sample:
name_example
 
output_file_format
string
on success
Specifies supported output file format.

Sample:
CSV
 
query_properties
complex
on success

   
compartment_depth
float
on success
The depth level of the compartment.

Sample:
10
   
date_range
complex
on success

     
date_range_type
string
on success
Defines whether the schedule date range is STATIC or DYNAMIC.

Sample:
STATIC
     
dynamic_date_range_type
string
on success

Sample:
LAST_7_DAYS
     
time_usage_ended
string
on success
The usage end time.

Sample:
2013-10-20T19:20:30+01:00
     
time_usage_started
string
on success
The usage start time.

Sample:
2013-10-20T19:20:30+01:00
   
filter
complex
on success

     
dimensions
complex
on success
The dimensions to filter on.

       
key
string
on success
The dimension key.

Sample:
key_example
       
value
string
on success
The dimension value.

Sample:
value_example
     
filters
complex
on success
The nested filter object.

       
dimensions
list / elements=string
on success
The dimensions to filter on.

       
filters
list / elements=string
on success
The nested filter object.

       
operator
string
on success
The filter operator. Example: 'AND', 'OR', 'NOT'.

Sample:
AND
       
tags
list / elements=string
on success
The tags to filter on.

     
operator
string
on success
The filter operator. Example: 'AND', 'OR', 'NOT'.

Sample:
AND
     
tags
complex
on success
The tags to filter on.

       
key
string
on success
The tag key.

Sample:
key_example
       
namespace
string
on success
The tag namespace.

Sample:
namespace_example
       
value
string
on success
The tag value.

Sample:
value_example
   
granularity
string
on success
The usage granularity. DAILY - Daily data aggregation. MONTHLY - Monthly data aggregation. Allowed values are: DAILY MONTHLY

Sample:
DAILY
   
group_by
list / elements=string
on success
Aggregate the result by. For example: [ "tagNamespace", "tagKey", "tagValue", "service", "skuName", "skuPartNumber", "unit", "compartmentName", "compartmentPath", "compartmentId", "platform", "region", "logicalAd", "resourceId", "tenantId", "tenantName" ]

   
group_by_tag
complex
on success
GroupBy a specific tagKey. Provide the tagNamespace and tagKey in the tag object. Only supports one tag in the list. For example: [ { "namespace": "oracle", "key": "createdBy" ]

     
key
string
on success
The tag key.

Sample:
key_example
     
namespace
string
on success
The tag namespace.

Sample:
namespace_example
     
value
string
on success
The tag value.

Sample:
value_example
   
is_aggregate_by_time
boolean
on success
Specifies whether aggregated by time. If isAggregateByTime is true, all usage or cost over the query time period will be added up.

Sample:
True
   
query_type
string
on success
The query usage type. COST by default if it is missing. Usage - Query the usage data. Cost - Query the cost/billing data. Allowed values are: USAGE COST USAGE_AND_COST

Sample:
USAGE
 
result_location
complex
on success

   
bucket_name
string
on success
The bucket name where usage or cost CSVs will be uploaded.

Sample:
bucket_name_example
   
location_type
string
on success
Defines the type of location where the usage or cost CSVs will be stored.

Sample:
OBJECT_STORAGE
   
namespace
string
on success
The namespace needed to determine the object storage bucket.

Sample:
namespace_example
   
region
string
on success
The destination Object Store Region specified by the customer.

Sample:
us-phoenix-1
 
saved_report_id
string
on success
The saved report id which can also be used to generate query.

Sample:
ocid1.savedreport.oc1..xxxxxxEXAMPLExxxxxx
 
schedule_recurrences
string
on success
Specifies the frequency according to when the schedule will be run, in the x-obmcs-recurring-time format described in RFC 5545 section 3.3.10. Supported values are : ONE_TIME, DAILY, WEEKLY and MONTHLY.

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

 
time_created
string
on success
The date and time the schedule was created.

Sample:
2013-10-20T19:20:30+01:00
 
time_next_run
string
on success
The date and time of the next job execution.

Sample:
2013-10-20T19:20:30+01:00
 
time_scheduled
string
on success
The date and time of the first time job execution.

Sample:
2013-10-20T19:20:30+01:00


Authors

  • Oracle (@oracle)