From c185dc32f9a36573354784bd1b5470830465a3ca Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Wed, 8 Jan 2025 18:23:05 -0800 Subject: [PATCH] route53: add support for type SSHFP (#2430) SUMMARY Fixes #2413 Adds support for record type 'SSHFP' ISSUE TYPE Feature Pull Request COMPONENT NAME route53 ADDITIONAL INFORMATION Reviewed-by: GomathiselviS Reviewed-by: Bikouo Aubin --- ...2430-route53-sshfp-record-type-support.yml | 3 ++ plugins/modules/route53.py | 37 ++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/2430-route53-sshfp-record-type-support.yml diff --git a/changelogs/fragments/2430-route53-sshfp-record-type-support.yml b/changelogs/fragments/2430-route53-sshfp-record-type-support.yml new file mode 100644 index 00000000000..6bdf2e17ccb --- /dev/null +++ b/changelogs/fragments/2430-route53-sshfp-record-type-support.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - route53 - Add support for type ``SSHFP`` records (https://github.com/ansible-collections/amazon.aws/pull/2430). \ No newline at end of file diff --git a/plugins/modules/route53.py b/plugins/modules/route53.py index c33a42b6573..c73fd8cf8a5 100644 --- a/plugins/modules/route53.py +++ b/plugins/modules/route53.py @@ -44,8 +44,10 @@ type: description: - The type of DNS record to create. + - Support for V(SSHFP) was added in release 9.2.0. See AWS Doc for more information + U(https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ResourceRecordTypes.html). required: true - choices: [ 'A', 'CNAME', 'MX', 'AAAA', 'TXT', 'PTR', 'SRV', 'SPF', 'CAA', 'NS', 'SOA' ] + choices: [ 'A', 'CNAME', 'MX', 'AAAA', 'TXT', 'PTR', 'SRV', 'SPF', 'CAA', 'NS', 'SOA', 'SSHFP' ] type: str alias: description: @@ -273,6 +275,7 @@ ttl: 7200 value: 1.1.1.1,2.2.2.2,3.3.3.3 wait: true + - name: Update new.foo.com as an A record with a list of 3 IPs and wait until the changes have been replicated amazon.aws.route53: state: present @@ -285,6 +288,7 @@ - 2.2.2.2 - 3.3.3.3 wait: true + - name: Retrieve the details for new.foo.com amazon.aws.route53: state: get @@ -292,6 +296,7 @@ record: new.foo.com type: A register: rec + - name: Delete new.foo.com A record using the results from the get command amazon.aws.route53: state: absent @@ -300,6 +305,7 @@ ttl: "{{ rec.set.ttl }}" type: "{{ rec.set.type }}" value: "{{ rec.set.value }}" + # Add an AAAA record. Note that because there are colons in the value # that the IPv6 address must be quoted. Also shows using the old form command=create. - name: Add an AAAA record @@ -310,6 +316,7 @@ type: AAAA ttl: 7200 value: "::1" + # For more information on SRV records see: # https://en.wikipedia.org/wiki/SRV_record - name: Add a SRV record with multiple fields for a service on port 22222 @@ -319,6 +326,7 @@ record: "_example-service._tcp.foo.com" type: SRV value: "0 0 22222 host1.foo.com,0 0 22222 host2.foo.com" + # Note that TXT and SPF records must be surrounded # by quotes when sent to Route 53: - name: Add a TXT record. @@ -329,6 +337,7 @@ type: TXT ttl: 7200 value: '"bar"' + - name: Add an alias record that points to an Amazon ELB amazon.aws.route53: state: present @@ -338,6 +347,7 @@ value: "{{ elb_dns_name }}" alias: true alias_hosted_zone_id: "{{ elb_zone_id }}" + - name: Retrieve the details for elb.foo.com amazon.aws.route53: state: get @@ -345,6 +355,7 @@ record: elb.foo.com type: A register: rec + - name: Delete an alias record using the results from the get command amazon.aws.route53: state: absent @@ -355,6 +366,7 @@ value: "{{ rec.set.value }}" alias: true alias_hosted_zone_id: "{{ rec.set.alias_hosted_zone_id }}" + - name: Add an alias record that points to an Amazon ELB and evaluates it health amazon.aws.route53: state: present @@ -365,6 +377,7 @@ alias: true alias_hosted_zone_id: "{{ elb_zone_id }}" alias_evaluate_target_health: true + - name: Add an AAAA record with Hosted Zone ID amazon.aws.route53: state: present @@ -374,6 +387,7 @@ type: AAAA ttl: 7200 value: "::1" + - name: Use a routing policy to distribute traffic amazon.aws.route53: state: present @@ -386,6 +400,7 @@ identifier: "host1@www" weight: 100 health_check: "d994b780-3150-49fd-9205-356abdd42e75" + - name: Add a CAA record (RFC 6844) amazon.aws.route53: state: present @@ -396,6 +411,7 @@ - 0 issue "ca.example.net" - 0 issuewild ";" - 0 iodef "mailto:security@example.com" + - name: Create a record with geo_location - country_code amazon.aws.route53: state: present @@ -407,6 +423,7 @@ ttl: 30 geo_location: country_code: US + - name: Create a record with geo_location - subdivision code amazon.aws.route53: state: present @@ -419,6 +436,22 @@ geo_location: country_code: US subdivision_code: TX + +- name: Add new.foo.com as an SSHFP record + amazon.aws.route53: + state: present + zone: test-zone.com + record: new.foo.com + type: SSHFP + ttl: 7200 + value: 1 1 11F1A11D1111112B111C1B11B1C11C11C1234567 + +- name: Delete new.foo.com as an SSHFP record + amazon.aws.route53: + state: absent + zone: test-zone.com + record: new.foo.com + type: SSHFP """ from operator import itemgetter @@ -558,7 +591,7 @@ def main(): type=dict( type="str", required=True, - choices=["A", "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"], + choices=["A", "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SPF", "SSHFP", "SRV", "TXT"], ), alias=dict(type="bool"), alias_hosted_zone_id=dict(type="str"),