Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR #2430/c185dc32 backport][stable-9] route53: add support for type SSHFP #2445

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- route53 - Add support for type ``SSHFP`` records (https://github.com/ansible-collections/amazon.aws/pull/2430).
37 changes: 35 additions & 2 deletions plugins/modules/route53.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -285,13 +288,15 @@
- 2.2.2.2
- 3.3.3.3
wait: true

- name: Retrieve the details for new.foo.com
amazon.aws.route53:
state: get
zone: foo.com
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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -338,13 +347,15 @@
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
zone: foo.com
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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -374,6 +387,7 @@
type: AAAA
ttl: 7200
value: "::1"

- name: Use a routing policy to distribute traffic
amazon.aws.route53:
state: present
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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"),
Expand Down
Loading