oracle / oracle.oci / 2.38.0 / module / oci_identity_tag_actions Perform actions on a Tag resource in Oracle Cloud Infrastructure | "added in version" 2.9.0 of oracle.oci" Authors: Oracle (@oracle) preview | supported by communityoracle.oci.oci_identity_tag_actions (2.38.0) — module
Install with ansible-galaxy collection install oracle.oci:==2.38.0
collections: - name: oracle.oci version: 2.38.0
Perform actions on a Tag resource in Oracle Cloud Infrastructure
For I(action=bulk_delete), deletes the specified tag key definitions. This operation triggers a process that removes the tags from all resources in your tenancy. The tag key definitions must be within the same tag namespace. The following actions happen immediately: * If the tag is a cost-tracking tag, the tag no longer counts against your 10 cost-tracking tags limit, even if you do not disable the tag before running this operation. * If the tag is used with dynamic groups, the rules that contain the tag are no longer evaluated against the tag. After you start this operation, the state of the tag changes to DELETING, and tag removal from resources begins. This process can take up to 48 hours depending on the number of resources that are tagged and the regions in which those resources reside. When all tags have been removed, the state changes to DELETED. You cannot restore a deleted tag. After the tag state changes to DELETED, you can use the same tag name again. After you start this operation, you cannot start either the L(DeleteTag,https://docs.cloud.oracle.com/en-us/iaas/api/#/en/identity/20160918/Tag/DeleteTag) or the L(CascadeDeleteTagNamespace,https://docs.cloud.oracle.com/en-us/iaas/api/#/en/identity/20160918/TagNamespace/CascadeDeleteTagNamespace) operation until this process completes. In order to delete tags, you must first retire the tags. Use L(UpdateTag,https://docs.cloud.oracle.com/en- us/iaas/api/#/en/identity/20160918/Tag/UpdateTag) to retire a tag.
For I(action=bulk_edit), edits the specified list of tag key definitions for the selected resources. This operation triggers a process that edits the tags on all selected resources. The possible actions are: * Add a defined tag when the tag does not already exist on the resource. * Update the value for a defined tag when the tag is present on the resource. * Add a defined tag when it does not already exist on the resource or update the value for a defined tag when the tag is present on the resource. * Remove a defined tag from a resource. The tag is removed from the resource regardless of the tag value. See L(BulkEditOperationDetails,https://docs.cloud.oracle.com/en-us/iaas/api/#/en/identity/latest/datatypes/BulkEditOperationDetails) for more information. The edits can include a combination of operations and tag sets. However, multiple operations cannot apply to one key definition in the same request. For example, if one request adds `tag set-1` to a resource and sets a tag value to `tag set-2`, `tag set-1` and `tag set-2` cannot have any common tag definitions.
For I(action=import_standard_tags), oCI will release Tag Namespaces that our customers can import. These Tag Namespaces will provide Tags for our customers and Partners to provide consistency and enable data reporting.
- name: Perform action bulk_delete on tag oci_identity_tag_actions: # required tag_definition_ids: [ "tag_definition_ids_example" ] action: bulk_delete
- name: Perform action bulk_edit on tag oci_identity_tag_actions: # required compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx" resources: - # required id: "ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx" resource_type: resource_type_example # optional metadata: null bulk_edit_operations: - # required operation_type: ADD_WHERE_ABSENT defined_tags: {'Operations': {'CostCenter': 'US'}} action: bulk_edit
- name: Perform action import_standard_tags on tag oci_identity_tag_actions: # required compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx" standard_tag_namespace_name: standard_tag_namespace_name_example action: import_standard_tags
wait: default: true description: Whether to wait for create or delete operation to complete. type: bool action: choices: - bulk_delete - bulk_edit - import_standard_tags description: - The action to perform on the Tag. required: true type: str region: description: - 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 C(config_file_location)). Please refer to U(https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm) for more information on OCI regions. type: str tenancy: description: - 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 C(config_file_location)). To get the tenancy OCID, please refer U(https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm) type: str api_user: description: - 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 C(config_file_location)). To get the user's OCID, please refer U(https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm). type: str auth_type: choices: - api_key - instance_principal - instance_obo_user - resource_principal default: api_key description: - The type of authentication to use for making API requests. By default C(auth_type="api_key") based authentication is performed and the API key (see I(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 C(auth_type="instance_principal") to use instance principal based authentication when running ansible playbooks within an OCI compute instance. type: str resources: description: - The resources to be updated. - Required for I(action=bulk_edit). elements: dict suboptions: id: description: - The unique OCID of the resource. required: true type: str metadata: description: - Additional information that identifies the resource for bulk editing of tags. This information is provided in the resource's API documentation. type: dict resource_type: description: - The type of resource. See L(BulkEditResourceTypes,https://docs.cloud.oracle.com/en- us/iaas/api/#/en/identity/latest/BulkEditTagsResourceTypeCollection/ListBulkEditTagsResourceTypes). required: true type: str type: list wait_timeout: description: Time, in seconds, to wait when I(wait=yes). Defaults to 1200 for most of the services but some services might have a longer wait timeout. type: int compartment_id: description: - The OCID of the compartment where the bulk tag edit request is submitted. - Required for I(action=bulk_edit), I(action=import_standard_tags). type: str api_user_key_file: description: - 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 C(config_file_location)). If the key is encrypted with a pass-phrase, the C(api_user_key_pass_phrase) option must also be provided. type: str tag_definition_ids: description: - The OCIDs of the tag definitions to delete - Required for I(action=bulk_delete). elements: str type: list config_profile_name: description: - The profile to load from the config file referenced by C(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 C(config_file_location). type: str api_user_fingerprint: description: - 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 C(config_file_location)). To get the key pair's fingerprint value please refer U(https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm). type: str bulk_edit_operations: description: - The operations associated with the request to bulk edit tags. - Required for I(action=bulk_edit). elements: dict suboptions: defined_tags: description: - 'Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see L(Resource Tags,https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm). Example: `{"Operations": {"CostCenter": "42"}}`' required: true type: dict operation_type: choices: - ADD_WHERE_ABSENT - SET_WHERE_PRESENT - ADD_OR_SET - REMOVE description: - An enum-like description of the type of operation. - '* `ADD_WHERE_ABSENT` adds a defined tag only if the tag does not already exist on the resource. * `SET_WHERE_PRESENT` updates the value for a defined tag only if the tag is present on the resource. * `ADD_OR_SET` combines the first two operations to add a defined tag if it does not already exist on the resource or update the value for a defined tag only if the tag is present on the resource. * `REMOVE` removes the defined tag from the resource. The tag is removed from the resource regardless of the tag value.' required: true type: str type: list config_file_location: description: - 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. type: str api_user_key_pass_phrase: description: - Passphrase used by the key referenced in C(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 C(config_file_location)). type: str standard_tag_namespace_name: description: - The name of standard tag namespace that will be imported in bulk - Required for I(action=import_standard_tags). type: str