mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-07-30 11:24:50 +00:00
ipaclient_test: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure that the documentation section and the agument spec is complete. Needed changes: DOCUMENTATION section - `type: str` needs to be set for string parameters - `type: list` needs to be set for list parameters - `elements: str` needs to be given for list of string parameters - `required` tags need to be fixed according to the `argument_spec` - `type` tag needs to match `argument_spec` - `default` tag needs to match `argument_spec` - `author` needs to be given with the github user also: `Name (@user)` RETURN section - `elements: str` needs to be given for list of string parameters - `type: string` is not valid and needs to be replaced by `type: str` - `returned` needs to be set argument_spec - `type='str'` needs to be set for string parameters - `elements='str'` needs to be added to all list of string parameters supports_check_mode is turned off as it is not supported. A call to ansible_ipa_client.check_imports has been added to check for import errors. The `copyright` date is extended with `-2022`.
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
#
|
#
|
||||||
# Based on ipa-client-install code
|
# Based on ipa-client-install code
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Red Hat
|
# Copyright (C) 2017-2022 Red Hat
|
||||||
# see file 'COPYING' for use and warranty information
|
# see file 'COPYING' for use and warranty information
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
@@ -40,70 +40,99 @@ description:
|
|||||||
options:
|
options:
|
||||||
domain:
|
domain:
|
||||||
description: Primary DNS domain of the IPA deployment
|
description: Primary DNS domain of the IPA deployment
|
||||||
required: yes
|
type: str
|
||||||
|
required: no
|
||||||
servers:
|
servers:
|
||||||
description: Fully qualified name of IPA servers to enroll to
|
description: Fully qualified name of IPA servers to enroll to
|
||||||
required: yes
|
type: list
|
||||||
|
elements: str
|
||||||
|
required: no
|
||||||
realm:
|
realm:
|
||||||
description: Kerberos realm name of the IPA deployment
|
description: Kerberos realm name of the IPA deployment
|
||||||
required: yes
|
type: str
|
||||||
|
required: no
|
||||||
hostname:
|
hostname:
|
||||||
description: Fully qualified name of this host
|
description: Fully qualified name of this host
|
||||||
required: yes
|
type: str
|
||||||
|
required: no
|
||||||
ntp_servers:
|
ntp_servers:
|
||||||
description: ntp servers to use
|
description: ntp servers to use
|
||||||
required: yes
|
type: list
|
||||||
|
elements: str
|
||||||
|
required: no
|
||||||
ntp_pool:
|
ntp_pool:
|
||||||
description: ntp server pool to use
|
description: ntp server pool to use
|
||||||
required: yes
|
type: str
|
||||||
|
required: no
|
||||||
no_ntp:
|
no_ntp:
|
||||||
description: Do not configure ntp
|
description: Do not configure ntp
|
||||||
required: yes
|
type: bool
|
||||||
|
required: no
|
||||||
|
default: no
|
||||||
force_ntpd:
|
force_ntpd:
|
||||||
description:
|
description:
|
||||||
Stop and disable any time&date synchronization services besides ntpd
|
Stop and disable any time&date synchronization services besides ntpd
|
||||||
Deprecated since 4.7
|
Deprecated since 4.7
|
||||||
required: yes
|
type: bool
|
||||||
|
required: no
|
||||||
|
default: no
|
||||||
nisdomain:
|
nisdomain:
|
||||||
description: The NIS domain name
|
description: The NIS domain name
|
||||||
required: yes
|
type: str
|
||||||
|
required: no
|
||||||
no_nisdomain:
|
no_nisdomain:
|
||||||
description: Do not configure NIS domain name
|
description: Do not configure NIS domain name
|
||||||
required: yes
|
type: bool
|
||||||
|
required: no
|
||||||
|
default: no
|
||||||
kinit_attempts:
|
kinit_attempts:
|
||||||
description: Repeat the request for host Kerberos ticket X times
|
description: Repeat the request for host Kerberos ticket X times
|
||||||
required: yes
|
type: int
|
||||||
|
required: no
|
||||||
ca_cert_files:
|
ca_cert_files:
|
||||||
description:
|
description:
|
||||||
List of files containing CA certificates for the service certificate
|
List of files containing CA certificates for the service certificate
|
||||||
files
|
files
|
||||||
required: yes
|
type: list
|
||||||
|
elements: str
|
||||||
|
required: no
|
||||||
configure_firefox:
|
configure_firefox:
|
||||||
description: Configure Firefox to use IPA domain credentials
|
description: Configure Firefox to use IPA domain credentials
|
||||||
required: yes
|
type: bool
|
||||||
|
required: no
|
||||||
|
default: no
|
||||||
firefox_dir:
|
firefox_dir:
|
||||||
description:
|
description:
|
||||||
Specify directory where Firefox is installed (for example
|
Specify directory where Firefox is installed (for example
|
||||||
'/usr/lib/firefox')
|
'/usr/lib/firefox')
|
||||||
required: yes
|
type: str
|
||||||
|
required: no
|
||||||
ip_addresses:
|
ip_addresses:
|
||||||
description: List of Master Server IP Addresses
|
description: List of Master Server IP Addresses
|
||||||
required: yes
|
type: list
|
||||||
|
elements: str
|
||||||
|
required: no
|
||||||
all_ip_addresses:
|
all_ip_addresses:
|
||||||
description:
|
description:
|
||||||
All routable IP addresses configured on any interface will be added
|
All routable IP addresses configured on any interface will be added
|
||||||
to DNS
|
to DNS
|
||||||
required: yes
|
type: bool
|
||||||
|
required: no
|
||||||
|
default: no
|
||||||
on_master:
|
on_master:
|
||||||
description: Whether the configuration is done on the master or not
|
description: Whether the configuration is done on the master or not
|
||||||
required: yes
|
type: bool
|
||||||
|
required: no
|
||||||
|
default: no
|
||||||
enable_dns_updates:
|
enable_dns_updates:
|
||||||
description:
|
description:
|
||||||
Configures the machine to attempt dns updates when the ip address
|
Configures the machine to attempt dns updates when the ip address
|
||||||
changes
|
changes
|
||||||
required: yes
|
type: bool
|
||||||
|
required: no
|
||||||
|
default: no
|
||||||
author:
|
author:
|
||||||
- Thomas Woerner
|
- Thomas Woerner (@t-woerner)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
@@ -142,36 +171,37 @@ servers:
|
|||||||
description: The list of detected or passed in IPA servers.
|
description: The list of detected or passed in IPA servers.
|
||||||
returned: always
|
returned: always
|
||||||
type: list
|
type: list
|
||||||
|
elements: str
|
||||||
sample: ["server1.example.com","server2.example.com"]
|
sample: ["server1.example.com","server2.example.com"]
|
||||||
domain:
|
domain:
|
||||||
description: The DNS domain of the detected or passed in IPA deployment.
|
description: The DNS domain of the detected or passed in IPA deployment.
|
||||||
returned: always
|
returned: always
|
||||||
type: string
|
type: str
|
||||||
sample: example.com
|
sample: example.com
|
||||||
realm:
|
realm:
|
||||||
description: The Kerberos realm of the detected or passed in IPA deployment.
|
description: The Kerberos realm of the detected or passed in IPA deployment.
|
||||||
returned: always
|
returned: always
|
||||||
type: string
|
type: str
|
||||||
sample: EXAMPLE.COM
|
sample: EXAMPLE.COM
|
||||||
kdc:
|
kdc:
|
||||||
description: The detected KDC server name.
|
description: The detected KDC server name.
|
||||||
returned: always
|
returned: always
|
||||||
type: string
|
type: str
|
||||||
sample: server1.example.com
|
sample: server1.example.com
|
||||||
basedn:
|
basedn:
|
||||||
description: The basedn of the detected IPA server.
|
description: The basedn of the detected IPA server.
|
||||||
returned: always
|
returned: always
|
||||||
type: string
|
type: str
|
||||||
sample: dc=example,dc=com
|
sample: dc=example,dc=com
|
||||||
hostname:
|
hostname:
|
||||||
description: The detected or passed in FQDN hostname of the client.
|
description: The detected or passed in FQDN hostname of the client.
|
||||||
returned: always
|
returned: always
|
||||||
type: string
|
type: str
|
||||||
sample: client1.example.com
|
sample: client1.example.com
|
||||||
client_domain:
|
client_domain:
|
||||||
description: The domain name of the client.
|
description: The domain name of the client.
|
||||||
returned: always
|
returned: always
|
||||||
type: string
|
type: str
|
||||||
sample: example.com
|
sample: example.com
|
||||||
dnsok:
|
dnsok:
|
||||||
description: True if DNS discovery worked and not passed in any servers.
|
description: True if DNS discovery worked and not passed in any servers.
|
||||||
@@ -181,6 +211,7 @@ ntp_servers:
|
|||||||
description: The list of detected NTP servers.
|
description: The list of detected NTP servers.
|
||||||
returned: always
|
returned: always
|
||||||
type: list
|
type: list
|
||||||
|
elements: str
|
||||||
sample: ["ntp.example.com"]
|
sample: ["ntp.example.com"]
|
||||||
ipa_python_version:
|
ipa_python_version:
|
||||||
description: >
|
description: >
|
||||||
@@ -192,7 +223,9 @@ ipa_python_version:
|
|||||||
nosssd_files:
|
nosssd_files:
|
||||||
description: >
|
description: >
|
||||||
The dist of nss_ldap or nss-pam-ldapd files if sssd is disabled
|
The dist of nss_ldap or nss-pam-ldapd files if sssd is disabled
|
||||||
|
returned: always
|
||||||
type: list
|
type: list
|
||||||
|
elements: str
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@@ -205,7 +238,7 @@ except ImportError:
|
|||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.ansible_ipa_client import (
|
from ansible.module_utils.ansible_ipa_client import (
|
||||||
setup_logging,
|
setup_logging, check_imports,
|
||||||
paths, sysrestore, options, CheckedIPAddress, validate_domain_name,
|
paths, sysrestore, options, CheckedIPAddress, validate_domain_name,
|
||||||
logger, x509, normalize_hostname, installer, version, ScriptError,
|
logger, x509, normalize_hostname, installer, version, ScriptError,
|
||||||
CLIENT_INSTALL_ERROR, tasks, check_ldap_conf, timeconf, constants,
|
CLIENT_INSTALL_ERROR, tasks, check_ldap_conf, timeconf, constants,
|
||||||
@@ -270,31 +303,36 @@ def main():
|
|||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
# basic
|
# basic
|
||||||
domain=dict(required=False, default=None),
|
domain=dict(required=False, type='str', default=None),
|
||||||
servers=dict(required=False, type='list', default=None),
|
servers=dict(required=False, type='list', elements='str',
|
||||||
realm=dict(required=False, default=None),
|
default=None),
|
||||||
hostname=dict(required=False, default=None),
|
realm=dict(required=False, type='str', default=None),
|
||||||
ntp_servers=dict(required=False, type='list', default=None),
|
hostname=dict(required=False, type='str', default=None),
|
||||||
ntp_pool=dict(required=False, default=None),
|
ntp_servers=dict(required=False, type='list', elements='str',
|
||||||
|
default=None),
|
||||||
|
ntp_pool=dict(required=False, type='str', default=None),
|
||||||
no_ntp=dict(required=False, type='bool', default=False),
|
no_ntp=dict(required=False, type='bool', default=False),
|
||||||
force_ntpd=dict(required=False, type='bool', default=False),
|
force_ntpd=dict(required=False, type='bool', default=False),
|
||||||
nisdomain=dict(required=False, default=None),
|
nisdomain=dict(required=False, type='str', default=None),
|
||||||
no_nisdomain=dict(required=False, type='bool', default='no'),
|
no_nisdomain=dict(required=False, type='bool', default='no'),
|
||||||
kinit_attempts=dict(required=False, type='int'),
|
kinit_attempts=dict(required=False, type='int'),
|
||||||
ca_cert_files=dict(required=False, type='list', default=None),
|
ca_cert_files=dict(required=False, type='list', elements='str',
|
||||||
|
default=None),
|
||||||
configure_firefox=dict(required=False, type='bool', default=False),
|
configure_firefox=dict(required=False, type='bool', default=False),
|
||||||
firefox_dir=dict(required=False),
|
firefox_dir=dict(required=False, type='str'),
|
||||||
ip_addresses=dict(required=False, type='list', default=None),
|
ip_addresses=dict(required=False, type='list', elements='str',
|
||||||
|
default=None),
|
||||||
all_ip_addresses=dict(required=False, type='bool', default=False),
|
all_ip_addresses=dict(required=False, type='bool', default=False),
|
||||||
on_master=dict(required=False, type='bool', default=False),
|
on_master=dict(required=False, type='bool', default=False),
|
||||||
# sssd
|
# sssd
|
||||||
enable_dns_updates=dict(required=False, type='bool',
|
enable_dns_updates=dict(required=False, type='bool',
|
||||||
default=False),
|
default=False),
|
||||||
),
|
),
|
||||||
supports_check_mode=True,
|
supports_check_mode=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
# module._ansible_debug = True
|
# module._ansible_debug = True
|
||||||
|
check_imports(module)
|
||||||
setup_logging()
|
setup_logging()
|
||||||
|
|
||||||
options.domain_name = module.params.get('domain')
|
options.domain_name = module.params.get('domain')
|
||||||
|
|||||||
Reference in New Issue
Block a user