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 required: false
default: present default: present
choices: ["present", "absent"] choices: ["present", "absent"]
ipa_port: extends_documentation_fragment: ipa.documentation
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
version_added: "2.5" version_added: "2.5"
''' '''
@ -84,7 +58,7 @@ zone:
''' '''
from ansible.module_utils.basic import AnsibleModule 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 from ansible.module_utils._text import to_native
@ -135,30 +109,14 @@ def ensure(module, client):
def main(): def main():
module = AnsibleModule( argument_spec = ipa_argument_spec()
argument_spec=dict( argument_spec.update(zone_name=dict(type='str', required=True),
zone_name=dict(type='str', required=True), state=dict(type='str', default='present', choices=['present', 'absent']),
ipa_prot=dict( )
type='str',
default='https', module = AnsibleModule(argument_spec=argument_spec,
choices=['http', 'https'] supports_check_mode=True,
), )
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,
)
client = DNSZoneIPAClient( client = DNSZoneIPAClient(
module=module, module=module,