oci_rrset - Update, Patch or Delete a collection of DNS records of the same domain and type in the specified zone in OCI DNS Service

New in version 2.5.

Synopsis

  • This module allows the user to update, patch or delete a collection of DNS records of the same domain and type 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.
domain
required
The target fully-qualified domain name (FQDN) within the target zone.
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 records in the specified zone.

aliases: zone_name
patch_items
The record operations to patch the RRSet collection. Updates records in the specified zone at a domain. You can update one record or all records for the specified zone depending on the changes provided in the request body. You can also add or remove records using this option. Required to patch a RRSet.
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.
rtype
required
The type of the target RRSet within the target zone.
state
    Choices:
  • present ←
  • absent
State of the RRSet. Use state='absent' to delete all records in the specified RRSet.
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 RRSet collection to. Replaces records in the specified zone at a domain with the records specified in the request body. If a specified record does not exist, it will be created. If the record exists, then it will be updated to represent the record in the body of the request. If a record in the zone does not exist in the request body, the record will be removed from the zone. Required to update a RRSet.
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 patch the collection of records in the specified zone.

aliases: id

Examples

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

- name: Patch a RRSet
  oci_rrset:
    name: test_zone1.com
    domain: "test_zone_1.com"
    rtype: "TXT"
    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
rrset
complex
On successful update or patch of the RRSet
Information about all the DNS records in the RRSet

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.