1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

ipa_dnsmodule: Add support for ns record management (#7737)

* Add NS record type management to ipa_dnsrecord

* Add jwbernin to BOTMETA for ipa_ modules

* Add changelog fragment

* Rename changelog fragment with pull request number

* Commit changes suggested by felixfontein
This commit is contained in:
John Berninger 2023-12-28 02:32:39 -05:00 committed by GitHub
parent 6d74e0c640
commit f79940c415
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 3 deletions

2
.github/BOTMETA.yml vendored
View file

@ -654,6 +654,8 @@ files:
maintainers: bregman-arie maintainers: bregman-arie
$modules/ipa_: $modules/ipa_:
maintainers: $team_ipa maintainers: $team_ipa
$modules/ipa_dnsrecord.py:
maintainers: $team_ipa jwbernin
$modules/ipbase_info.py: $modules/ipbase_info.py:
maintainers: dominikkukacka maintainers: dominikkukacka
$modules/ipa_pwpolicy.py: $modules/ipa_pwpolicy.py:

View file

@ -0,0 +1,2 @@
minor_changes:
- ipa_dnsrecord - adds ability to manage NS record types (https://github.com/ansible-collections/community.general/pull/7737).

View file

@ -35,12 +35,13 @@ options:
record_type: record_type:
description: description:
- The type of DNS record name. - The type of DNS record name.
- Currently, 'A', 'AAAA', 'A6', 'CNAME', 'DNAME', 'PTR', 'TXT', 'SRV' and 'MX' are supported. - Currently, 'A', 'AAAA', 'A6', 'CNAME', 'DNAME', 'NS', 'PTR', 'TXT', 'SRV' and 'MX' are supported.
- "'A6', 'CNAME', 'DNAME' and 'TXT' are added in version 2.5." - "'A6', 'CNAME', 'DNAME' and 'TXT' are added in version 2.5."
- "'SRV' and 'MX' are added in version 2.8." - "'SRV' and 'MX' are added in version 2.8."
- "'NS' are added in comunity.general 8.2.0."
required: false required: false
default: 'A' default: 'A'
choices: ['A', 'AAAA', 'A6', 'CNAME', 'DNAME', 'MX', 'PTR', 'SRV', 'TXT'] choices: ['A', 'AAAA', 'A6', 'CNAME', 'DNAME', 'MX', 'NS', 'PTR', 'SRV', 'TXT']
type: str type: str
record_value: record_value:
description: description:
@ -51,6 +52,7 @@ options:
- In the case of 'A6' record type, this will be the A6 Record data. - In the case of 'A6' record type, this will be the A6 Record data.
- In the case of 'CNAME' record type, this will be the hostname. - In the case of 'CNAME' record type, this will be the hostname.
- In the case of 'DNAME' record type, this will be the DNAME target. - In the case of 'DNAME' record type, this will be the DNAME target.
- In the case of 'NS' record type, this will be the name server hostname. Hostname must already have a valid A or AAAA record.
- In the case of 'PTR' record type, this will be the hostname. - In the case of 'PTR' record type, this will be the hostname.
- In the case of 'TXT' record type, this will be a text. - In the case of 'TXT' record type, this will be a text.
- In the case of 'SRV' record type, this will be a service record. - In the case of 'SRV' record type, this will be a service record.
@ -64,6 +66,7 @@ options:
- In the case of 'A6' record type, this will be the A6 Record data. - In the case of 'A6' record type, this will be the A6 Record data.
- In the case of 'CNAME' record type, this will be the hostname. - In the case of 'CNAME' record type, this will be the hostname.
- In the case of 'DNAME' record type, this will be the DNAME target. - In the case of 'DNAME' record type, this will be the DNAME target.
- In the case of 'NS' record type, this will be the name server hostname. Hostname must already have a valid A or AAAA record.
- In the case of 'PTR' record type, this will be the hostname. - In the case of 'PTR' record type, this will be the hostname.
- In the case of 'TXT' record type, this will be a text. - In the case of 'TXT' record type, this will be a text.
- In the case of 'SRV' record type, this will be a service record. - In the case of 'SRV' record type, this will be a service record.
@ -162,6 +165,16 @@ EXAMPLES = r'''
ipa_user: admin ipa_user: admin
ipa_pass: topsecret ipa_pass: topsecret
state: absent state: absent
- name: Ensure an NS record for a subdomain is present
community,general.ipa_dnsrecord:
name: subdomain
zone_name: example.com
record_type: 'NS'
record_value: 'ns1.subdomain.exmaple.com'
ipa_host: ipa.example.com
ipa_user: admin
ipa_pass: ChangeMe!
''' '''
RETURN = r''' RETURN = r'''
@ -205,6 +218,8 @@ class DNSRecordIPAClient(IPAClient):
item.update(cname_part_hostname=value) item.update(cname_part_hostname=value)
elif details['record_type'] == 'DNAME': elif details['record_type'] == 'DNAME':
item.update(dname_part_target=value) item.update(dname_part_target=value)
elif details['record_type'] == 'NS':
item.update(ns_part_hostname=value)
elif details['record_type'] == 'PTR': elif details['record_type'] == 'PTR':
item.update(ptr_part_hostname=value) item.update(ptr_part_hostname=value)
elif details['record_type'] == 'TXT': elif details['record_type'] == 'TXT':
@ -241,6 +256,8 @@ def get_dnsrecord_dict(details=None):
module_dnsrecord.update(cnamerecord=details['record_values']) module_dnsrecord.update(cnamerecord=details['record_values'])
elif details['record_type'] == 'DNAME' and details['record_values']: elif details['record_type'] == 'DNAME' and details['record_values']:
module_dnsrecord.update(dnamerecord=details['record_values']) module_dnsrecord.update(dnamerecord=details['record_values'])
elif details['record_type'] == 'NS' and details['record_values']:
module_dnsrecord.update(nsrecord=details['record_values'])
elif details['record_type'] == 'PTR' and details['record_values']: elif details['record_type'] == 'PTR' and details['record_values']:
module_dnsrecord.update(ptrrecord=details['record_values']) module_dnsrecord.update(ptrrecord=details['record_values'])
elif details['record_type'] == 'TXT' and details['record_values']: elif details['record_type'] == 'TXT' and details['record_values']:
@ -311,7 +328,7 @@ def ensure(module, client):
def main(): def main():
record_types = ['A', 'AAAA', 'A6', 'CNAME', 'DNAME', 'PTR', 'TXT', 'SRV', 'MX'] record_types = ['A', 'AAAA', 'A6', 'CNAME', 'DNAME', 'NS', 'PTR', 'TXT', 'SRV', 'MX']
argument_spec = ipa_argument_spec() argument_spec = ipa_argument_spec()
argument_spec.update( argument_spec.update(
zone_name=dict(type='str', required=True), zone_name=dict(type='str', required=True),