community / community.general / 1.3.14 / module / gcdns_record
Removed in 2.0.0
Reason:Updated modules released with increased functionality | Alternative:Use M(google.cloud.gcp_dns_resource_record_set) instead.
Creates or removes resource records in Google Cloud DNS
Authors: William Albert (@walbert947)
Install with ansible-galaxy collection install community.general:==1.3.14
collections: - name: community.general version: 1.3.14
Creates or removes resource records in Google Cloud DNS.
- name: Create an A record community.general.gcdns_record: record: 'www1.example.com' zone: 'example.com' type: A value: '1.2.3.4'
- name: Update an existing record community.general.gcdns_record: record: 'www1.example.com' zone: 'example.com' type: A overwrite: true value: '5.6.7.8'
- name: Remove an A record community.general.gcdns_record: record: 'www1.example.com' zone_id: 'example-com' state: absent type: A value: '5.6.7.8'
- name: Create a CNAME record. Note the trailing dot of value community.general.gcdns_record: record: 'www.example.com' zone_id: 'example-com' type: CNAME value: 'www.example.com.'
- name: Create an MX record with a custom TTL. Note the trailing dot of value community.general.gcdns_record: record: 'example.com' zone: 'example.com' type: MX ttl: 3600 value: '10 mail.example.com.'
- name: Create multiple A records with the same name community.general.gcdns_record: record: 'api.example.com' zone_id: 'example-com' type: A record_data: - '192.0.2.23' - '10.4.5.6' - '198.51.100.5' - '203.0.113.10'
- name: Change the value of an existing record with multiple record_data community.general.gcdns_record: record: 'api.example.com' zone: 'example.com' type: A overwrite: true record_data: # WARNING: All values in a record will be replaced - '192.0.2.23' - '192.0.2.42' # The changed record - '198.51.100.5' - '203.0.113.10'
- name: Safely remove a multi-line record community.general.gcdns_record: record: 'api.example.com' zone_id: 'example-com' state: absent type: A record_data: # NOTE: All of the values must match exactly - '192.0.2.23' - '192.0.2.42' - '198.51.100.5' - '203.0.113.10'
- name: Unconditionally remove a record community.general.gcdns_record: record: 'api.example.com' zone_id: 'example-com' state: absent overwrite: true # overwrite is true, so no values are needed type: A
- name: Create an AAAA record community.general.gcdns_record: record: 'www1.example.com' zone: 'example.com' type: AAAA value: 'fd00:db8::1'
- name: Create a PTR record community.general.gcdns_record: record: '10.5.168.192.in-addr.arpa' zone: '5.168.192.in-addr.arpa' type: PTR value: 'api.example.com.' # Note the trailing dot.
- name: Create an NS record community.general.gcdns_record: record: 'subdomain.example.com' zone: 'example.com' type: NS ttl: 21600 record_data: - 'ns-cloud-d1.googledomains.com.' # Note the trailing dots on values - 'ns-cloud-d2.googledomains.com.' - 'ns-cloud-d3.googledomains.com.' - 'ns-cloud-d4.googledomains.com.'
- name: Create a TXT record community.general.gcdns_record: record: 'example.com' zone_id: 'example-com' type: TXT record_data: - '"v=spf1 include:_spf.google.com -all"' # A single-string TXT value - '"hello " "world"' # A multi-string TXT value
ttl: default: 300 description: - The amount of time in seconds that a resource record will remain cached by a caching resolver. type: int type: choices: - A - AAAA - CNAME - SRV - TXT - SOA - NS - MX - SPF - PTR description: - The type of resource record to add. required: true type: str zone: description: - The DNS domain name of the zone (e.g., example.com). - One of either I(zone) or I(zone_id) must be specified as an option, or the module will fail. - If both I(zone) and I(zone_id) are specified, I(zone_id) will be used. type: str state: choices: - present - absent default: present description: - Whether the given resource record should or should not be present. type: str record: aliases: - name description: - The fully-qualified domain name of the resource record. required: true type: str zone_id: description: - The Google Cloud ID of the zone (e.g., example-com). - One of either I(zone) or I(zone_id) must be specified as an option, or the module will fail. - These usually take the form of domain names with the dots replaced with dashes. A zone ID will never have any dots in it. - I(zone_id) can be faster than I(zone) in projects with a large number of zones. - If both I(zone) and I(zone_id) are specified, I(zone_id) will be used. type: str pem_file: description: - The path to the PEM file associated with the service account email. - This option is deprecated and may be removed in a future release. Use I(credentials_file) instead. type: path overwrite: default: 'no' description: - Whether an attempt to overwrite an existing record should succeed or fail. The behavior of this option depends on I(state). - If I(state) is C(present) and I(overwrite) is C(True), this module will replace an existing resource record of the same name with the provided I(record_data). If I(state) is C(present) and I(overwrite) is C(False), this module will fail if there is an existing resource record with the same name and type, but different resource data. - If I(state) is C(absent) and I(overwrite) is C(True), this module will remove the given resource record unconditionally. If I(state) is C(absent) and I(overwrite) is C(False), this module will fail if the provided record_data do not match exactly with the existing resource record's record_data. type: bool project_id: description: - The Google Cloud Platform project ID to use. type: str record_data: aliases: - value description: - The record_data to use for the resource record. - I(record_data) must be specified if I(state) is C(present) or I(overwrite) is C(True), or the module will fail. - Valid record_data vary based on the record's I(type). In addition, resource records that contain a DNS domain name in the value field (e.g., CNAME, PTR, SRV, .etc) MUST include a trailing dot in the value. - Individual string record_data for TXT records must be enclosed in double quotes. - For resource records that have the same name but different record_data (e.g., multiple A records), they must be defined as multiple list entries in a single record. required: false type: list credentials_file: description: - The path to the JSON file associated with the service account email. type: path service_account_email: description: - The e-mail address for a service account with access to Google Cloud DNS. type: str
overwrite: description: Whether to the module was allowed to overwrite the record returned: success sample: true type: bool record: description: Fully-qualified domain name of the resource record returned: success sample: mail.example.com. type: str record_data: description: The resource record values returned: success sample: - 5.6.7.8 - 9.10.11.12 type: list state: description: Whether the record is present or absent returned: success sample: present type: str ttl: description: The time-to-live of the resource record returned: success sample: 300 type: int type: description: The type of the resource record returned: success sample: A type: str zone: description: The dns name of the zone returned: success sample: example.com. type: str zone_id: description: The Google Cloud DNS ID of the zone returned: success sample: example-com type: str