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

freeipa: Refactor ipa_dnszone (#34078)

Code refactoring of ipa_dnszone module
- use ipa_argument_spec
- use common documentation fragment

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2017-12-20 21:29:52 +05:30 committed by GitHub
parent c50da48049
commit 5db9ac23ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,33 +29,7 @@ options:
required: false
default: present
choices: ["present", "absent"]
ipa_port:
description: Port of IPA server
required: false
default: 443
ipa_host:
description: IP or hostname of IPA server
required: false
default: localhost
ipa_user:
description: Administrative account used on IPA server
required: false
default: admin
ipa_pass:
description: Password of administrative user
required: true
ipa_prot:
description: Protocol used by IPA server
required: false
default: https
choices: ["http", "https"]
validate_certs:
description:
- This only applies if C(ipa_prot) is I(https).
- If set to C(no), the SSL certificates will not be validated.
- This should only set to C(no) used on personally controlled sites using self-signed certificates.
required: false
default: true
extends_documentation_fragment: ipa.documentation
version_added: "2.5"
'''
@ -84,7 +58,7 @@ zone:
'''
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ipa import IPAClient
from ansible.module_utils.ipa import IPAClient, ipa_argument_spec
from ansible.module_utils._text import to_native
@ -135,30 +109,14 @@ def ensure(module, client):
def main():
module = AnsibleModule(
argument_spec=dict(
zone_name=dict(type='str', required=True),
ipa_prot=dict(
type='str',
default='https',
choices=['http', 'https']
),
ipa_host=dict(
type='str',
default='localhost'
),
state=dict(
type='str',
default='present',
choices=['present', 'absent']
),
ipa_port=dict(type='int', default=443),
ipa_user=dict(type='str', default='admin'),
ipa_pass=dict(type='str', required=True, no_log=True),
validate_certs=dict(type='bool', default=True),
),
supports_check_mode=True,
)
argument_spec = ipa_argument_spec()
argument_spec.update(zone_name=dict(type='str', required=True),
state=dict(type='str', default='present', choices=['present', 'absent']),
)
module = AnsibleModule(argument_spec=argument_spec,
supports_check_mode=True,
)
client = DNSZoneIPAClient(
module=module,