mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[PR #7737/f79940c4 backport][stable-8] ipa_dnsmodule: Add support for ns record management (#7771)
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
(cherry picked from commit f79940c415
)
Co-authored-by: John Berninger <john.berninger@gmail.com>
This commit is contained in:
parent
a7bbf99448
commit
fc70818ee3
3 changed files with 24 additions and 3 deletions
2
.github/BOTMETA.yml
vendored
2
.github/BOTMETA.yml
vendored
|
@ -654,6 +654,8 @@ files:
|
|||
maintainers: bregman-arie
|
||||
$modules/ipa_:
|
||||
maintainers: $team_ipa
|
||||
$modules/ipa_dnsrecord.py:
|
||||
maintainers: $team_ipa jwbernin
|
||||
$modules/ipbase_info.py:
|
||||
maintainers: dominikkukacka
|
||||
$modules/ipa_pwpolicy.py:
|
||||
|
|
2
changelogs/fragments/7737-add-ipa-dnsrecord-ns-type.yml
Normal file
2
changelogs/fragments/7737-add-ipa-dnsrecord-ns-type.yml
Normal 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).
|
|
@ -35,12 +35,13 @@ options:
|
|||
record_type:
|
||||
description:
|
||||
- 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."
|
||||
- "'SRV' and 'MX' are added in version 2.8."
|
||||
- "'NS' are added in comunity.general 8.2.0."
|
||||
required: false
|
||||
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
|
||||
record_value:
|
||||
description:
|
||||
|
@ -51,6 +52,7 @@ options:
|
|||
- 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 '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 'TXT' record type, this will be a text.
|
||||
- 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 '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 '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 'TXT' record type, this will be a text.
|
||||
- In the case of 'SRV' record type, this will be a service record.
|
||||
|
@ -162,6 +165,16 @@ EXAMPLES = r'''
|
|||
ipa_user: admin
|
||||
ipa_pass: topsecret
|
||||
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'''
|
||||
|
@ -205,6 +218,8 @@ class DNSRecordIPAClient(IPAClient):
|
|||
item.update(cname_part_hostname=value)
|
||||
elif details['record_type'] == 'DNAME':
|
||||
item.update(dname_part_target=value)
|
||||
elif details['record_type'] == 'NS':
|
||||
item.update(ns_part_hostname=value)
|
||||
elif details['record_type'] == 'PTR':
|
||||
item.update(ptr_part_hostname=value)
|
||||
elif details['record_type'] == 'TXT':
|
||||
|
@ -241,6 +256,8 @@ def get_dnsrecord_dict(details=None):
|
|||
module_dnsrecord.update(cnamerecord=details['record_values'])
|
||||
elif details['record_type'] == 'DNAME' and 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']:
|
||||
module_dnsrecord.update(ptrrecord=details['record_values'])
|
||||
elif details['record_type'] == 'TXT' and details['record_values']:
|
||||
|
@ -311,7 +328,7 @@ def ensure(module, client):
|
|||
|
||||
|
||||
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.update(
|
||||
zone_name=dict(type='str', required=True),
|
||||
|
|
Loading…
Reference in a new issue