oci_zone_records - Update or Patch a collection of records in the specified zone in OCI DNS Service

New in version 2.5.

Synopsis

  • This module allows the user to update or patch a collection of records in the specified DNS zone in OCI DNS Service.

Requirements

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

Parameters

Parameter Choices/Defaults Comments
api_user
The OCID of the user, on whose behalf, OCI APIs are invoked. If not set, then the value of the OCI_USER_OCID 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
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
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
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_type
    Choices:
  • api_key ←
  • instance_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.
compartment_id
The OCID of the compartment the resource belongs to.
config_file_location
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 Default:
DEFAULT
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.
name
The name of the zone. Required to create a zone. Either name or zone_id must be specified to update or patch the collection of recordsin the specified zone.

aliases: zone_name
patch_items
The record operations to patch the Zone's records collection. Required to patch a zone.
domain
The fully qualified domain name where the record can be located.
rtype
The canonical name for the record's type, such as A or CNAME. For more information, see L(Resource Record (RR) TYPEs,https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4).
rr_set_version
The latest version of the record's zone in which its RRSet differs from the preceding version.
rdata
The record's data, as whitespace-delimited tokens in type-specific presentation format.
is_protected
A Boolean flag indicating whether or not parts of the record are unable to be explicitly managed.
ttl
required
The Time To Live for the record, in seconds.
operation
    Choices:
  • REQUIRE
  • PROHIBIT
  • ADD
  • REMOVE
A description of how a record relates to a PATCH operation. REQUIRE indicates a precondition that record data must already exist. PROHIBIT indicates a precondition that record data must not already exist. ADD indicates that record data must exist after successful application. REMOVE indicates that record data must not exist after successful application. Note - ADD and REMOVE operations can succeed even if they require no changes when applied, such as when the described records are already present or absent. Note - ADD and REMOVE operations can describe changes for more than one record. Example - { "domain" - "www.example.com", "rtype" - "AAAA", "ttl" - 60 } specifies a new TTL for every record in the www.example.com AAAA RRSet.'
record_hash
A unique identifier for the record within its zone.
region
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.
state
    Choices:
  • present ←
State of the Zone records
tenancy
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
update_items
The items to update the Zone's records collection to. Required to update a zone.
domain
required
The fully qualified domain name where the record can be located.
is_protected
A Boolean flag indicating whether or not parts of the record are unable to be explicitly managed.
rtype
required
The canonical name for the record's type, such as A or CNAME. For more information, see L(Resource Record (RR) TYPEs,https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4).
rr_set_version
The latest version of the record's zone in which its RRSet differs from the preceding version.
ttl
required
The Time To Live for the record, in seconds.
record_hash
A unique identifier for the record within its zone.
rdata
required
The record's data, as whitespace-delimited tokens in type-specific presentation format.
wait
bool
    Choices:
  • no
  • yes ←
Whether to wait for create or delete operation to complete.
wait_timeout Default:
1200
Time, in seconds, to wait when wait=yes.
wait_until
The lifecycle state to wait for the resource to transition into when wait=yes. By default, when wait=yes, we wait for the resource to get into ACTIVE/ATTACHED/AVAILABLE/PROVISIONED/ RUNNING applicable lifecycle state during create operation & to get into DELETED/DETACHED/ TERMINATED lifecycle state during delete operation.
zone_id
The OCID of the target zone. Either name or zone_id must be specified to update or path the collection of records in the specified zone.

aliases: id

Examples

- name: Update a zone's records by adding a new record. This operation replaces records in the specified zone with the
        specified records. So ensure that you include the original zone records, if you want to retain existing records.
  oci_zone_records:
    name: "test_zone_1.com"
    update_items: [ <original zone records...> , { domain: "test_zone_1.com", ttl: 30, rtype='TXT', rdata='some textual
                    data' } ]

- name: Patch a zone's records
  oci_zone_records:
    name: test_zone1.com
    patch_items: [{
                    domain: "test_zone_1.com",
                    is_protected: false,
                    rdata: "some textual data",
                    rtype: "TXT",
                    ttl: 30,
                    operation: "REMOVE"
                    }]

Return Values

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

Key Returned Description
zone_records
complex
On successful update or patch of zone's resource records
Information about the zone's resource records

Sample:
{'domain': 'test_zone_1.com', 'is_protected': True, 'rrset_version': '1', 'rtype': 'NS', 'ttl': 86400, 'record_hash': '9be3279d81b5e8430fd94c70cfa5f0a8', 'rdata': 'ns2.p68.dns.oraclecloud.net.'}
  domain
string
always
The fully qualified domain name where the record can be located.

Sample:
test_zone_1.com
  is_protected
boolean
always
A Boolean flag indicating whether or not parts of the record are unable to be explicitly managed.

  rrsetVersion
string
always
The latest version of the record's zone in which its RRSet differs from the preceding version.

Sample:
5
  rtype
string
always
The canonical name for the record's type, such as A or CNAME. For more information, see L(Resource Record (RR) TYPEs, https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4).

Sample:
NS
  ttl
string
always
The Time To Live for the record, in seconds.

Sample:
86400
  record_hash
string
always
A unique identifier for the record within its zone.

Sample:
722af089872ffe65ba909fc8fea1867e
  rdata
string
always
The record's data, as whitespace-delimited tokens in type-specific presentation format.

Sample:
ns3.p68.dns.oraclecloud.net.


Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Author

  • Sivakumar Thyagarajan (@sivakumart)

Hint

If you notice any issues in this documentation you can edit this document to improve it.