mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-05-14 13:32:10 +00:00
ipa[server,replica,client]: flake8 and pylint fixes
These are white space and line length changes to calm down pylint and flake8.
This commit is contained in:
@@ -52,9 +52,10 @@ from ansible.module_utils.ansible_ipa_server import (
|
||||
service, bindinstance, redirect_stdout, services
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
ansible_module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
argument_spec=dict(
|
||||
hostname=dict(required=False),
|
||||
setup_dns=dict(required=True, type='bool'),
|
||||
setup_ca=dict(required=True, type='bool'),
|
||||
@@ -111,5 +112,6 @@ def main():
|
||||
|
||||
ansible_module.exit_json(changed=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -51,14 +51,14 @@ import os
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.ansible_ipa_server import (
|
||||
#AnsibleModuleLog,
|
||||
options, paths, read_cache
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
ansible_module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
### basic ###
|
||||
argument_spec=dict(
|
||||
# basic
|
||||
dm_password=dict(required=True, no_log=True),
|
||||
),
|
||||
)
|
||||
@@ -67,7 +67,7 @@ def main():
|
||||
|
||||
# set values ############################################################
|
||||
|
||||
### basic ###
|
||||
# basic
|
||||
options.dm_password = ansible_module.params.get('dm_password')
|
||||
|
||||
# restore cache #########################################################
|
||||
@@ -85,7 +85,7 @@ def main():
|
||||
ansible_module.fail_json(
|
||||
msg="Cannot process the cache file: %s" % str(e))
|
||||
|
||||
kwargs = { "changed": True }
|
||||
kwargs = {"changed": True}
|
||||
for name in options.__dict__:
|
||||
kwargs[name] = options.__dict__[name]
|
||||
ansible_module.exit_json(**kwargs)
|
||||
@@ -94,5 +94,6 @@ def main():
|
||||
|
||||
ansible_module.exit_json(changed=False)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -58,14 +58,15 @@ from ansible.module_utils.ansible_ipa_server import (
|
||||
options, paths, read_cache, ipa_generate_password
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
#basic
|
||||
argument_spec=dict(
|
||||
# basic
|
||||
dm_password=dict(required=True, no_log=True),
|
||||
master_password=dict(required=False, no_log=True),
|
||||
),
|
||||
supports_check_mode = True,
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
module._ansible_debug = True
|
||||
@@ -88,5 +89,6 @@ def main():
|
||||
module.exit_json(changed=True,
|
||||
password=options.master_password)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -86,10 +86,11 @@ from ansible.module_utils.ansible_ipa_server import (
|
||||
services, logger, tasks, update_hosts_file, ScriptError
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
ansible_module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
### basic ###
|
||||
argument_spec=dict(
|
||||
# basic
|
||||
force=dict(required=False, type='bool', default=False),
|
||||
dm_password=dict(required=True, no_log=True),
|
||||
password=dict(required=True, no_log=True),
|
||||
@@ -99,21 +100,22 @@ def main():
|
||||
hostname=dict(required=False),
|
||||
ca_cert_files=dict(required=False, type='list', default=[]),
|
||||
no_host_dns=dict(required=False, type='bool', default=False),
|
||||
### server ###
|
||||
# server
|
||||
setup_adtrust=dict(required=False, type='bool', default=False),
|
||||
setup_kra=dict(required=False, type='bool', default=False),
|
||||
setup_dns=dict(required=False, type='bool', default=False),
|
||||
### ssl certificate ###
|
||||
### client ###
|
||||
### certificate system ###
|
||||
# ssl certificate
|
||||
# client
|
||||
# certificate system
|
||||
external_ca=dict(required=False, type='bool'),
|
||||
external_ca_type=dict(required=False),
|
||||
external_ca_profile=dict(required=False),
|
||||
external_cert_files=dict(required=False, type='list', default=[]),
|
||||
subject_base=dict(required=False),
|
||||
ca_subject=dict(required=False),
|
||||
### dns ###
|
||||
allow_zone_overlap=dict(required=False, type='bool', default=False),
|
||||
# dns
|
||||
allow_zone_overlap=dict(required=False, type='bool',
|
||||
default=False),
|
||||
reverse_zones=dict(required=False, type='list', default=[]),
|
||||
no_reverse=dict(required=False, type='bool', default=False),
|
||||
auto_reverse=dict(required=False, type='bool', default=False),
|
||||
@@ -123,18 +125,18 @@ def main():
|
||||
forward_policy=dict(default=None, choices=['first', 'only']),
|
||||
no_dnssec_validation=dict(required=False, type='bool',
|
||||
default=False),
|
||||
### ad trust ###
|
||||
# ad trust
|
||||
enable_compat=dict(required=False, type='bool', default=False),
|
||||
netbios_name=dict(required=False),
|
||||
rid_base=dict(required=False, type='int'),
|
||||
secondary_rid_base=dict(required=False, type='int'),
|
||||
|
||||
### additional ###
|
||||
# additional
|
||||
setup_ca=dict(required=False, type='bool', default=False),
|
||||
_hostname_overridden=dict(required=False, type='bool',
|
||||
default=False),
|
||||
default=False),
|
||||
),
|
||||
supports_check_mode = True,
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
ansible_module._ansible_debug = True
|
||||
@@ -152,16 +154,17 @@ def main():
|
||||
options.host_name = ansible_module.params.get('hostname')
|
||||
options.ca_cert_files = ansible_module.params.get('ca_cert_files')
|
||||
options.no_host_dns = ansible_module.params.get('no_host_dns')
|
||||
### server ###
|
||||
# server
|
||||
options.setup_adtrust = ansible_module.params.get('setup_adtrust')
|
||||
options.setup_kra = ansible_module.params.get('setup_kra')
|
||||
options.setup_dns = ansible_module.params.get('setup_dns')
|
||||
#options.no_pkinit = ansible_module.params.get('no_pkinit')
|
||||
### ssl certificate ###
|
||||
#options.dirsrv_cert_files = ansible_module.params.get('dirsrv_cert_files')
|
||||
### client ###
|
||||
#options.no_ntp = ansible_module.params.get('no_ntp')
|
||||
### certificate system ###
|
||||
# options.no_pkinit = ansible_module.params.get('no_pkinit')
|
||||
# ssl certificate
|
||||
# options.dirsrv_cert_files = ansible_module.params.get(
|
||||
# 'dirsrv_cert_files')
|
||||
# client
|
||||
# options.no_ntp = ansible_module.params.get('no_ntp')
|
||||
# certificate system
|
||||
options.external_ca = ansible_module.params.get('external_ca')
|
||||
options.external_ca_type = ansible_module.params.get('external_ca_type')
|
||||
options.external_ca_profile = ansible_module.params.get(
|
||||
@@ -170,8 +173,9 @@ def main():
|
||||
'external_cert_files')
|
||||
options.subject_base = ansible_module.params.get('subject_base')
|
||||
options.ca_subject = ansible_module.params.get('ca_subject')
|
||||
### dns ###
|
||||
options.allow_zone_overlap = ansible_module.params.get('allow_zone_overlap')
|
||||
# dns
|
||||
options.allow_zone_overlap = ansible_module.params.get(
|
||||
'allow_zone_overlap')
|
||||
options.reverse_zones = ansible_module.params.get('reverse_zones')
|
||||
options.no_reverse = ansible_module.params.get('no_reverse')
|
||||
options.auto_reverse = ansible_module.params.get('auto_reverse')
|
||||
@@ -181,10 +185,10 @@ def main():
|
||||
options.forward_policy = ansible_module.params.get('forward_policy')
|
||||
options.no_dnssec_validation = ansible_module.params.get(
|
||||
'no_dnssec_validation')
|
||||
### ad trust ###
|
||||
# ad trust
|
||||
options.enable_compat = ansible_module.params.get('enable_compat')
|
||||
options.netbios_name = ansible_module.params.get('netbios_name')
|
||||
### additional ###
|
||||
# additional
|
||||
options.setup_ca = ansible_module.params.get('setup_ca')
|
||||
options._host_name_overridden = ansible_module.params.get(
|
||||
'_hostname_overridden')
|
||||
@@ -227,9 +231,9 @@ def main():
|
||||
fd.write("basedn=%s\n" % ipautil.realm_to_suffix(options.realm_name))
|
||||
fd.write("realm=%s\n" % options.realm_name)
|
||||
fd.write("domain=%s\n" % options.domain_name)
|
||||
fd.write("xmlrpc_uri=https://%s/ipa/xml\n" % \
|
||||
fd.write("xmlrpc_uri=https://%s/ipa/xml\n" %
|
||||
ipautil.format_netloc(options.host_name))
|
||||
fd.write("ldap_uri=ldapi://%%2fvar%%2frun%%2fslapd-%s.socket\n" % \
|
||||
fd.write("ldap_uri=ldapi://%%2fvar%%2frun%%2fslapd-%s.socket\n" %
|
||||
installutils.realm_to_serverid(options.realm_name))
|
||||
if options.setup_ca:
|
||||
fd.write("enable_ra=True\n")
|
||||
@@ -256,11 +260,13 @@ def main():
|
||||
|
||||
if options.setup_dns:
|
||||
with redirect_stdout(ansible_log):
|
||||
dns.install_check(False, api, False, options, options.host_name)
|
||||
dns.install_check(False, api, False, options,
|
||||
options.host_name)
|
||||
ip_addresses = dns.ip_addresses
|
||||
else:
|
||||
ip_addresses = get_server_ip_address(options.host_name,
|
||||
not options.interactive, False,
|
||||
not options.interactive,
|
||||
False,
|
||||
options.ip_addresses)
|
||||
|
||||
# check addresses here, dns module is doing own check
|
||||
@@ -270,9 +276,9 @@ def main():
|
||||
|
||||
instance_name = "-".join(options.realm_name.split("."))
|
||||
dirsrv = services.knownservices.dirsrv
|
||||
if (options.external_cert_files
|
||||
and dirsrv.is_installed(instance_name)
|
||||
and not dirsrv.is_running(instance_name)):
|
||||
if options.external_cert_files \
|
||||
and dirsrv.is_installed(instance_name) \
|
||||
and not dirsrv.is_running(instance_name):
|
||||
logger.debug('Starting Directory Server')
|
||||
services.knownservices.dirsrv.start(instance_name)
|
||||
|
||||
@@ -301,25 +307,27 @@ def main():
|
||||
ipautil.CalledProcessError) as e:
|
||||
ansible_module.fail_json(msg=str(e))
|
||||
|
||||
ansible_module.exit_json(changed=True,
|
||||
### basic ###
|
||||
ip_addresses=[ str(ip) for ip in ip_addresses ],
|
||||
### certificate system ###
|
||||
subject_base=options.subject_base,
|
||||
_subject_base=options._subject_base,
|
||||
ca_subject=options.ca_subject,
|
||||
_ca_subject=options._ca_subject,
|
||||
### dns ###
|
||||
reverse_zones=options.reverse_zones,
|
||||
forward_policy=options.forward_policy,
|
||||
forwarders=options.forwarders,
|
||||
no_dnssec_validation=options.no_dnssec_validation,
|
||||
### additional ###
|
||||
dns_ip_addresses=[ str(ip) for ip
|
||||
in dns.ip_addresses ],
|
||||
dns_reverse_zones=dns.reverse_zones,
|
||||
adtrust_netbios_name=adtrust.netbios_name,
|
||||
adtrust_reset_netbios_name=adtrust.reset_netbios_name)
|
||||
ansible_module.exit_json(
|
||||
changed=True,
|
||||
# basic
|
||||
ip_addresses=[str(ip) for ip in ip_addresses],
|
||||
# certificate system
|
||||
subject_base=options.subject_base,
|
||||
_subject_base=options._subject_base,
|
||||
ca_subject=options.ca_subject,
|
||||
_ca_subject=options._ca_subject,
|
||||
# dns
|
||||
reverse_zones=options.reverse_zones,
|
||||
forward_policy=options.forward_policy,
|
||||
forwarders=options.forwarders,
|
||||
no_dnssec_validation=options.no_dnssec_validation,
|
||||
# additional
|
||||
dns_ip_addresses=[str(ip) for ip
|
||||
in dns.ip_addresses],
|
||||
dns_reverse_zones=dns.reverse_zones,
|
||||
adtrust_netbios_name=adtrust.netbios_name,
|
||||
adtrust_reset_netbios_name=adtrust.reset_netbios_name)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -55,14 +55,14 @@ from ansible.module_utils.ansible_ipa_server import (
|
||||
|
||||
def main():
|
||||
ansible_module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
### basic ###
|
||||
argument_spec=dict(
|
||||
# basic
|
||||
dm_password=dict(required=True, no_log=True),
|
||||
password=dict(required=True, no_log=True),
|
||||
domain=dict(required=True),
|
||||
realm=dict(required=True),
|
||||
hostname=dict(required=True),
|
||||
### server ###
|
||||
# server
|
||||
setup_ca=dict(required=True, type='bool'),
|
||||
idstart=dict(required=True, type='int'),
|
||||
idmax=dict(required=True, type='int'),
|
||||
@@ -70,13 +70,13 @@ def main():
|
||||
no_pkinit=dict(required=False, type='bool', default=False),
|
||||
dirsrv_config_file=dict(required=False),
|
||||
_dirsrv_pkcs12_info=dict(required=False),
|
||||
### ssl certificate ###
|
||||
# ssl certificate
|
||||
dirsrv_cert_files=dict(required=False, type='list', default=[]),
|
||||
subject_base=dict(required=False),
|
||||
ca_subject=dict(required=False),
|
||||
### certificate system ###
|
||||
# certificate system
|
||||
external_cert_files=dict(required=False, type='list', default=[]),
|
||||
### additional ###
|
||||
# additional
|
||||
domainlevel=dict(required=False, type='int',
|
||||
default=MAX_DOMAIN_LEVEL),
|
||||
),
|
||||
@@ -87,29 +87,30 @@ def main():
|
||||
|
||||
# set values ####################################################
|
||||
|
||||
### basic ###
|
||||
# basic
|
||||
options.dm_password = ansible_module.params.get('dm_password')
|
||||
options.admin_password = ansible_module.params.get('password')
|
||||
options.domain_name = ansible_module.params.get('domain')
|
||||
options.realm_name = ansible_module.params.get('realm')
|
||||
options.host_name = ansible_module.params.get('hostname')
|
||||
### server ###
|
||||
# server
|
||||
options.setup_ca = ansible_module.params.get('setup_ca')
|
||||
options.idstart = ansible_module.params.get('idstart')
|
||||
options.idmax = ansible_module.params.get('idmax')
|
||||
options.no_hbac_allow = ansible_module.params.get('no_hbac_allow')
|
||||
options.no_pkinit = ansible_module.params.get('no_pkinit')
|
||||
options.dirsrv_config_file = ansible_module.params.get('dirsrv_config_file')
|
||||
options.dirsrv_config_file = ansible_module.params.get(
|
||||
'dirsrv_config_file')
|
||||
options._dirsrv_pkcs12_info = ansible_module.params.get(
|
||||
'_dirsrv_pkcs12_info')
|
||||
### ssl certificate ###
|
||||
# ssl certificate
|
||||
options.dirsrv_cert_files = ansible_module.params.get('dirsrv_cert_files')
|
||||
options.subject_base = ansible_module.params.get('subject_base')
|
||||
options.ca_subject = ansible_module.params.get('ca_subject')
|
||||
### certificate system ###
|
||||
# certificate system
|
||||
options.external_cert_files = ansible_module.params.get(
|
||||
'external_cert_files')
|
||||
### additional ###
|
||||
# additional
|
||||
options.domainlevel = ansible_module.params.get('domainlevel')
|
||||
options.domain_level = options.domainlevel
|
||||
|
||||
@@ -137,5 +138,6 @@ def main():
|
||||
|
||||
ansible_module.exit_json(changed=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -52,20 +52,21 @@ from ansible.module_utils.ansible_ipa_server import (
|
||||
api_Backend_ldap2, redirect_stdout, adtrust, api
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
ansible_module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
argument_spec=dict(
|
||||
# basic
|
||||
hostname=dict(required=False),
|
||||
setup_ca=dict(required=False, type='bool', default=False),
|
||||
setup_adtrust=dict(required=False, type='bool', default=False),
|
||||
### ad trust ###
|
||||
# ad trust
|
||||
enable_compat=dict(required=False, type='bool', default=False),
|
||||
rid_base=dict(required=False, type='int'),
|
||||
secondary_rid_base=dict(required=False, type='int'),
|
||||
### additional ###
|
||||
# additional
|
||||
adtrust_netbios_name=dict(required=True),
|
||||
adtrust_reset_netbios_name=dict(required=True, type='bool')
|
||||
adtrust_reset_netbios_name=dict(required=True, type='bool'),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -77,14 +78,15 @@ def main():
|
||||
options.host_name = ansible_module.params.get('hostname')
|
||||
options.setup_ca = ansible_module.params.get('setup_ca')
|
||||
options.setup_adtrust = ansible_module.params.get('setup_adtrust')
|
||||
### ad trust ###
|
||||
# ad trust
|
||||
options.enable_compat = ansible_module.params.get('enable_compat')
|
||||
options.rid_base = ansible_module.params.get('rid_base')
|
||||
options.secondary_rid_base = ansible_module.params.get('secondary_rid_base')
|
||||
### additional ###
|
||||
options.secondary_rid_base = ansible_module.params.get(
|
||||
'secondary_rid_base')
|
||||
# additional
|
||||
adtrust.netbios_name = ansible_module.params.get('adtrust_netbios_name')
|
||||
adtrust.reset_netbios_name = \
|
||||
ansible_module.params.get('adtrust_reset_netbios_name')
|
||||
adtrust.reset_netbios_name = ansible_module.params.get(
|
||||
'adtrust_reset_netbios_name')
|
||||
|
||||
# init ##########################################################
|
||||
|
||||
@@ -101,5 +103,6 @@ def main():
|
||||
|
||||
ansible_module.exit_json(changed=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -86,10 +86,11 @@ from ansible.module_utils.ansible_ipa_server import (
|
||||
custodiainstance, write_cache, x509
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
ansible_module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
### basic ###
|
||||
argument_spec=dict(
|
||||
# basic
|
||||
dm_password=dict(required=True, no_log=True),
|
||||
password=dict(required=True, no_log=True),
|
||||
master_password=dict(required=True, no_log=True),
|
||||
@@ -99,7 +100,7 @@ def main():
|
||||
hostname=dict(required=False),
|
||||
no_host_dns=dict(required=False, type='bool', default=False),
|
||||
pki_config_override=dict(required=False),
|
||||
### server ###
|
||||
# server
|
||||
setup_adtrust=dict(required=False, type='bool', default=False),
|
||||
setup_kra=dict(required=False, type='bool', default=False),
|
||||
setup_dns=dict(required=False, type='bool', default=False),
|
||||
@@ -111,21 +112,22 @@ def main():
|
||||
dirsrv_config_file=dict(required=False),
|
||||
dirsrv_cert_files=dict(required=False, type='list'),
|
||||
_dirsrv_pkcs12_info=dict(required=False),
|
||||
### certificate system ###
|
||||
# certificate system
|
||||
external_ca=dict(required=False, type='bool', default=False),
|
||||
external_ca_type=dict(required=False),
|
||||
external_ca_profile=dict(required=False),
|
||||
external_cert_files=dict(required=False, type='list', default=None),
|
||||
external_cert_files=dict(required=False, type='list',
|
||||
default=None),
|
||||
subject_base=dict(required=False),
|
||||
_subject_base=dict(required=False),
|
||||
ca_subject=dict(required=False),
|
||||
_ca_subject=dict(required=False),
|
||||
ca_signing_algorithm=dict(required=False),
|
||||
### dns ###
|
||||
# dns
|
||||
reverse_zones=dict(required=False, type='list', default=[]),
|
||||
no_reverse=dict(required=False, type='bool', default=False),
|
||||
auto_forwarders=dict(required=False, type='bool', default=False),
|
||||
### additional ###
|
||||
# additional
|
||||
domainlevel=dict(required=False, type='int'),
|
||||
_http_ca_cert=dict(required=False),
|
||||
),
|
||||
@@ -136,7 +138,7 @@ def main():
|
||||
|
||||
# set values ############################################################
|
||||
|
||||
### basic ###
|
||||
# basic
|
||||
options.dm_password = ansible_module.params.get('dm_password')
|
||||
options.admin_password = ansible_module.params.get('password')
|
||||
options.master_password = ansible_module.params.get('master_password')
|
||||
@@ -148,7 +150,7 @@ def main():
|
||||
options.no_host_dns = ansible_module.params.get('no_host_dns')
|
||||
options.pki_config_override = ansible_module.params.get(
|
||||
'pki_config_override')
|
||||
### server ###
|
||||
# server
|
||||
options.setup_adtrust = ansible_module.params.get('setup_adtrust')
|
||||
options.setup_kra = ansible_module.params.get('setup_kra')
|
||||
options.setup_dns = ansible_module.params.get('setup_dns')
|
||||
@@ -157,11 +159,12 @@ def main():
|
||||
options.idmax = ansible_module.params.get('idmax')
|
||||
options.no_hbac_allow = ansible_module.params.get('no_hbac_allow')
|
||||
options.no_pkinit = ansible_module.params.get('no_pkinit')
|
||||
options.dirsrv_config_file = ansible_module.params.get('dirsrv_config_file')
|
||||
options.dirsrv_config_file = ansible_module.params.get(
|
||||
'dirsrv_config_file')
|
||||
options.dirsrv_cert_files = ansible_module.params.get('dirsrv_cert_files')
|
||||
options._dirsrv_pkcs12_info = ansible_module.params.get(
|
||||
'_dirsrv_pkcs12_info')
|
||||
### certificate system ###
|
||||
# certificate system
|
||||
options.external_ca = ansible_module.params.get('external_ca')
|
||||
options.external_ca_type = ansible_module.params.get('external_ca_type')
|
||||
options.external_ca_profile = ansible_module.params.get(
|
||||
@@ -174,14 +177,15 @@ def main():
|
||||
options._ca_subject = ansible_module.params.get('_ca_subject')
|
||||
options.ca_signing_algorithm = ansible_module.params.get(
|
||||
'ca_signing_algorithm')
|
||||
### dns ###
|
||||
# dns
|
||||
options.reverse_zones = ansible_module.params.get('reverse_zones')
|
||||
options.no_reverse = ansible_module.params.get('no_reverse')
|
||||
options.auto_forwarders = ansible_module.params.get('auto_forwarders')
|
||||
### additional ###
|
||||
# additional
|
||||
options.domainlevel = ansible_module.params.get('domainlevel')
|
||||
options._http_ca_cert = ansible_module.params.get('_http_ca_cert')
|
||||
#options._update_hosts_file = ansible_module.params.get('update_hosts_file')
|
||||
# tions._update_hosts_file = ansible_module.params.get(
|
||||
# 'update_hosts_file')
|
||||
|
||||
# init #################################################################
|
||||
|
||||
@@ -265,5 +269,6 @@ def main():
|
||||
ansible_module.exit_json(changed=True,
|
||||
csr_generated=False)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -50,15 +50,16 @@ RETURN = '''
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.ansible_ipa_server import (
|
||||
AnsibleModuleLog, options, # sysrestore, paths,
|
||||
from ansible.module_utils.ansible_ipa_server import (
|
||||
AnsibleModuleLog, options,
|
||||
api_Backend_ldap2,
|
||||
custodiainstance, redirect_stdout
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
ansible_module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
argument_spec=dict(
|
||||
# basic
|
||||
realm=dict(required=True),
|
||||
hostname=dict(required=False),
|
||||
@@ -99,5 +100,6 @@ def main():
|
||||
|
||||
ansible_module.exit_json(changed=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -60,24 +60,25 @@ from ansible.module_utils.ansible_ipa_server import (
|
||||
redirect_stdout, bindinstance
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
ansible_module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
### basic ###
|
||||
argument_spec=dict(
|
||||
# basic
|
||||
ip_addresses=dict(required=False, type='list', default=[]),
|
||||
domain=dict(required=True),
|
||||
realm=dict(required=True),
|
||||
hostname=dict(required=True),
|
||||
### server ###
|
||||
# server
|
||||
setup_dns=dict(required=True, type='bool'),
|
||||
setup_ca=dict(required=True, type='bool'),
|
||||
### dns ###
|
||||
# dns
|
||||
zonemgr=dict(required=False),
|
||||
forwarders=dict(required=True, type='list'),
|
||||
forward_policy=dict(default='first', choices=['first', 'only']),
|
||||
no_dnssec_validation=dict(required=False, type='bool',
|
||||
default=False),
|
||||
### additional ###
|
||||
# additional
|
||||
dns_ip_addresses=dict(required=True, type='list'),
|
||||
dns_reverse_zones=dict(required=True, type='list'),
|
||||
),
|
||||
@@ -88,22 +89,22 @@ def main():
|
||||
|
||||
# set values ############################################################
|
||||
|
||||
### basic ###
|
||||
# basic
|
||||
options.ip_addresses = ansible_module_get_parsed_ip_addresses(
|
||||
ansible_module)
|
||||
options.domain_name = ansible_module.params.get('domain')
|
||||
options.realm_name = ansible_module.params.get('realm')
|
||||
options.host_name = ansible_module.params.get('hostname')
|
||||
### server ###
|
||||
# server
|
||||
options.setup_dns = ansible_module.params.get('setup_dns')
|
||||
options.setup_ca = ansible_module.params.get('setup_ca')
|
||||
### dns ###
|
||||
# dns
|
||||
options.zonemgr = ansible_module.params.get('zonemgr')
|
||||
options.forwarders = ansible_module.params.get('forwarders')
|
||||
options.forward_policy = ansible_module.params.get('forward_policy')
|
||||
options.no_dnssec_validation = ansible_module.params.get(
|
||||
'no_dnssec_validation')
|
||||
### additional ###
|
||||
# additional
|
||||
dns.ip_addresses = ansible_module_get_parsed_ip_addresses(
|
||||
ansible_module, 'dns_ip_addresses')
|
||||
dns.reverse_zones = ansible_module.params.get('dns_reverse_zones')
|
||||
@@ -134,5 +135,6 @@ def main():
|
||||
|
||||
ansible_module.exit_json(changed=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -65,30 +65,31 @@ from ansible.module_utils.ansible_ipa_server import (
|
||||
dsinstance, ntpinstance, IPAAPI_USER
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
ansible_module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
### basic ###
|
||||
argument_spec=dict(
|
||||
# basic
|
||||
dm_password=dict(required=True, no_log=True),
|
||||
password=dict(required=True, no_log=True),
|
||||
domain=dict(required=True),
|
||||
realm=dict(required=True),
|
||||
hostname=dict(required=False),
|
||||
### server ###
|
||||
# server
|
||||
idstart=dict(required=True, type='int'),
|
||||
idmax=dict(required=True, type='int'),
|
||||
no_hbac_allow=dict(required=False, type='bool', default=False),
|
||||
no_pkinit=dict(required=False, type='bool', default=False),
|
||||
dirsrv_config_file=dict(required=False),
|
||||
### ssl certificate ###
|
||||
# ssl certificate
|
||||
dirsrv_cert_files=dict(required=False, type='list', default=[]),
|
||||
_dirsrv_pkcs12_info=dict(required=False),
|
||||
### certificate system ###
|
||||
# certificate system
|
||||
external_cert_files=dict(required=False, type='list', default=[]),
|
||||
subject_base=dict(required=False),
|
||||
ca_subject=dict(required=False),
|
||||
|
||||
### additional ###
|
||||
# additional
|
||||
setup_ca=dict(required=False, type='bool', default=False),
|
||||
),
|
||||
)
|
||||
@@ -98,28 +99,29 @@ def main():
|
||||
|
||||
# set values ############################################################
|
||||
|
||||
### basic ###
|
||||
# basic
|
||||
options.dm_password = ansible_module.params.get('dm_password')
|
||||
options.domain_name = ansible_module.params.get('domain')
|
||||
options.realm_name = ansible_module.params.get('realm')
|
||||
options.host_name = ansible_module.params.get('hostname')
|
||||
### server ###
|
||||
# server
|
||||
options.idstart = ansible_module.params.get('idstart')
|
||||
options.idmax = ansible_module.params.get('idmax')
|
||||
options.no_pkinit = ansible_module.params.get('no_pkinit')
|
||||
options.no_hbac_allow = ansible_module.params.get('no_hbac_allow')
|
||||
options.dirsrv_config_file = ansible_module.params.get('dirsrv_config_file')
|
||||
options.dirsrv_config_file = ansible_module.params.get(
|
||||
'dirsrv_config_file')
|
||||
options._dirsrv_pkcs12_info = ansible_module.params.get(
|
||||
'_dirsrv_pkcs12_info')
|
||||
### ssl certificate ###
|
||||
# ssl certificate
|
||||
options.dirsrv_cert_files = ansible_module.params.get('dirsrv_cert_files')
|
||||
### certificate system ###
|
||||
# certificate system
|
||||
options.external_cert_files = ansible_module.params.get(
|
||||
'external_cert_files')
|
||||
options.subject_base = ansible_module.params.get('subject_base')
|
||||
options.ca_subject = ansible_module.params.get('ca_subject')
|
||||
|
||||
### additional ###
|
||||
# additional
|
||||
options.setup_ca = ansible_module.params.get('setup_ca')
|
||||
|
||||
# init ##################################################################
|
||||
@@ -145,9 +147,9 @@ def main():
|
||||
ds.set_output(ansible_log)
|
||||
|
||||
if options.dirsrv_cert_files:
|
||||
_dirsrv_pkcs12_info=options._dirsrv_pkcs12_info
|
||||
_dirsrv_pkcs12_info = options._dirsrv_pkcs12_info
|
||||
else:
|
||||
_dirsrv_pkcs12_info=None
|
||||
_dirsrv_pkcs12_info = None
|
||||
|
||||
with redirect_stdout(ansible_log):
|
||||
ds.create_instance(options.realm_name, options.host_name,
|
||||
@@ -180,5 +182,6 @@ def main():
|
||||
|
||||
ansible_module.exit_json(changed=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -54,9 +54,10 @@ from ansible.module_utils.ansible_ipa_server import (
|
||||
krbinstance, httpinstance, ca, service, tasks
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
ansible_module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
argument_spec=dict(
|
||||
# basic
|
||||
dm_password=dict(required=True, no_log=True),
|
||||
password=dict(required=True, no_log=True),
|
||||
@@ -95,7 +96,8 @@ def main():
|
||||
no_reverse=dict(required=False, type='bool', default=False),
|
||||
auto_forwarders=dict(required=False, type='bool', default=False),
|
||||
|
||||
#_update_hosts_file=dict(required=False, type='bool', default=False),
|
||||
# _update_hosts_file=dict(required=False, type='bool',
|
||||
# default=False),
|
||||
_dirsrv_pkcs12_info=dict(required=False),
|
||||
_http_pkcs12_info=dict(required=False),
|
||||
),
|
||||
@@ -141,10 +143,12 @@ def main():
|
||||
options.idstart = ansible_module.params.get('idstart')
|
||||
options.idmax = ansible_module.params.get('idmax')
|
||||
options.domainlevel = ansible_module.params.get('domainlevel')
|
||||
options.dirsrv_config_file = ansible_module.params.get('dirsrv_config_file')
|
||||
options.dirsrv_config_file = ansible_module.params.get(
|
||||
'dirsrv_config_file')
|
||||
options.dirsrv_cert_files = ansible_module.params.get('dirsrv_cert_files')
|
||||
|
||||
#options._update_hosts_file = ansible_module.params.get('_update_hosts_file')
|
||||
# options._update_hosts_file = ansible_module.params.get(
|
||||
# '_update_hosts_file')
|
||||
options._dirsrv_pkcs12_info = ansible_module.params.get(
|
||||
'_dirsrv_pkcs12_info')
|
||||
options._http_pkcs12_info = ansible_module.params.get(
|
||||
@@ -181,13 +185,16 @@ def main():
|
||||
with redirect_stdout(ansible_log):
|
||||
if options.http_cert_files:
|
||||
http.create_instance(
|
||||
options.realm_name, options.host_name, options.domain_name, options.dm_password,
|
||||
pkcs12_info=options._http_pkcs12_info, subject_base=options.subject_base,
|
||||
options.realm_name, options.host_name, options.domain_name,
|
||||
options.dm_password,
|
||||
pkcs12_info=options._http_pkcs12_info,
|
||||
subject_base=options.subject_base,
|
||||
auto_redirect=not options.no_ui_redirect,
|
||||
ca_is_configured=options.setup_ca)
|
||||
else:
|
||||
http.create_instance(
|
||||
options.realm_name, options.host_name, options.domain_name, options.dm_password,
|
||||
options.realm_name, options.host_name, options.domain_name,
|
||||
options.dm_password,
|
||||
subject_base=options.subject_base,
|
||||
auto_redirect=not options.no_ui_redirect,
|
||||
ca_is_configured=options.setup_ca)
|
||||
@@ -212,5 +219,6 @@ def main():
|
||||
|
||||
ansible_module.exit_json(changed=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -52,9 +52,10 @@ from ansible.module_utils.ansible_ipa_server import (
|
||||
api_Backend_ldap2, redirect_stdout, api, custodiainstance, kra
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
ansible_module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
argument_spec=dict(
|
||||
# basic
|
||||
dm_password=dict(required=True, no_log=True),
|
||||
hostname=dict(required=True),
|
||||
@@ -101,5 +102,6 @@ def main():
|
||||
|
||||
ansible_module.exit_json(changed=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -53,9 +53,10 @@ from ansible.module_utils.ansible_ipa_server import (
|
||||
api_Backend_ldap2, redirect_stdout, krbinstance
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
ansible_module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
argument_spec=dict(
|
||||
# basic
|
||||
dm_password=dict(required=True, no_log=True),
|
||||
password=dict(required=True, no_log=True),
|
||||
@@ -129,7 +130,8 @@ def main():
|
||||
options._pkinit_pkcs12_info = ansible_module.params.get(
|
||||
'_pkinit_pkcs12_info')
|
||||
|
||||
#options._update_hosts_file = ansible_module.params.get('update_hosts_file')
|
||||
# options._update_hosts_file = ansible_module.params.get(
|
||||
# 'update_hosts_file')
|
||||
|
||||
# init ##################################################################
|
||||
|
||||
@@ -156,5 +158,6 @@ def main():
|
||||
|
||||
ansible_module.exit_json(changed=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -54,9 +54,10 @@ from ansible.module_utils.ansible_ipa_server import (
|
||||
redirect_stdout, time_service, sync_time, ntpinstance, timeconf
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
ansible_module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
argument_spec=dict(
|
||||
ntp_servers=dict(required=False, type='list', default=None),
|
||||
ntp_pool=dict(required=False, default=None),
|
||||
),
|
||||
@@ -109,5 +110,6 @@ def main():
|
||||
|
||||
ansible_module.exit_json(changed=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -48,13 +48,14 @@ RETURN = '''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.ansible_ipa_server import (
|
||||
AnsibleModuleLog, options, # sysrestore, paths,
|
||||
AnsibleModuleLog, options,
|
||||
api_Backend_ldap2, redirect_stdout, otpdinstance, ipautil
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
ansible_module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
argument_spec=dict(
|
||||
# basic
|
||||
realm=dict(required=True),
|
||||
hostname=dict(required=False),
|
||||
@@ -87,5 +88,6 @@ def main():
|
||||
|
||||
ansible_module.exit_json(changed=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -52,7 +52,7 @@ import inspect
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.ansible_ipa_server import (
|
||||
AnsibleModuleLog, options, adtrust_imported, kra_imported, PKIIniLoader,
|
||||
random, MIN_DOMAIN_LEVEL, MAX_DOMAIN_LEVEL, check_zone_overlap,
|
||||
MIN_DOMAIN_LEVEL, MAX_DOMAIN_LEVEL, check_zone_overlap,
|
||||
redirect_stdout, validate_dm_password, validate_admin_password,
|
||||
NUM_VERSION, is_ipa_configured, sysrestore, paths, bindinstance,
|
||||
read_cache, ca, tasks, check_ldap_conf, timeconf, httpinstance,
|
||||
@@ -66,8 +66,8 @@ if six.PY3:
|
||||
|
||||
def main():
|
||||
ansible_module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
### basic ###
|
||||
argument_spec=dict(
|
||||
# basic
|
||||
force=dict(required=False, type='bool', default=False),
|
||||
dm_password=dict(required=True, no_log=True),
|
||||
password=dict(required=True, no_log=True),
|
||||
@@ -78,7 +78,7 @@ def main():
|
||||
ca_cert_files=dict(required=False, type='list', default=[]),
|
||||
no_host_dns=dict(required=False, type='bool', default=False),
|
||||
pki_config_override=dict(required=False),
|
||||
### server ###
|
||||
# server
|
||||
setup_adtrust=dict(required=False, type='bool', default=False),
|
||||
setup_kra=dict(required=False, type='bool', default=False),
|
||||
setup_dns=dict(required=False, type='bool', default=False),
|
||||
@@ -88,7 +88,7 @@ def main():
|
||||
no_pkinit=dict(required=False, type='bool', default=False),
|
||||
# no_ui_redirect
|
||||
dirsrv_config_file=dict(required=False),
|
||||
### ssl certificate ###
|
||||
# ssl certificate
|
||||
dirsrv_cert_files=dict(required=False, type='list', default=None),
|
||||
http_cert_files=dict(required=False, type='list', defaullt=None),
|
||||
pkinit_cert_files=dict(required=False, type='list', default=None),
|
||||
@@ -98,7 +98,7 @@ def main():
|
||||
dirsrv_cert_name=dict(required=False),
|
||||
http_cert_name=dict(required=False),
|
||||
pkinit_cert_name=dict(required=False),
|
||||
### client ###
|
||||
# client
|
||||
# mkhomedir
|
||||
ntp_servers=dict(required=False, type='list', default=None),
|
||||
ntp_pool=dict(required=False, default=None),
|
||||
@@ -107,16 +107,18 @@ def main():
|
||||
# no_ssh
|
||||
# no_sshd
|
||||
# no_dns_sshfp
|
||||
### certificate system ###
|
||||
# certificate system
|
||||
external_ca=dict(required=False, type='bool', default=False),
|
||||
external_ca_type=dict(required=False),
|
||||
external_ca_profile=dict(required=False),
|
||||
external_cert_files=dict(required=False, type='list', default=None),
|
||||
external_cert_files=dict(required=False, type='list',
|
||||
default=None),
|
||||
subject_base=dict(required=False),
|
||||
ca_subject=dict(required=False),
|
||||
# ca_signing_algorithm
|
||||
### dns ###
|
||||
allow_zone_overlap=dict(required=False, type='bool', default=False),
|
||||
# dns
|
||||
allow_zone_overlap=dict(required=False, type='bool',
|
||||
default=False),
|
||||
reverse_zones=dict(required=False, type='list', default=[]),
|
||||
no_reverse=dict(required=False, type='bool', default=False),
|
||||
auto_reverse=dict(required=False, type='bool', default=False),
|
||||
@@ -127,16 +129,15 @@ def main():
|
||||
forward_policy=dict(default=None, choices=['first', 'only']),
|
||||
no_dnssec_validation=dict(required=False, type='bool',
|
||||
default=False),
|
||||
### ad trust ###
|
||||
# ad trust
|
||||
enable_compat=dict(required=False, type='bool', default=False),
|
||||
netbios_name=dict(required=False),
|
||||
rid_base=dict(required=False, type='int', default=1000),
|
||||
secondary_rid_base=dict(required=False, type='int',
|
||||
default=100000000),
|
||||
|
||||
### additional ###
|
||||
# additional
|
||||
),
|
||||
supports_check_mode = True,
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
ansible_module._ansible_debug = True
|
||||
@@ -144,7 +145,7 @@ def main():
|
||||
|
||||
# set values ############################################################
|
||||
|
||||
### basic ###
|
||||
# basic
|
||||
options.force = ansible_module.params.get('force')
|
||||
options.dm_password = ansible_module.params.get('dm_password')
|
||||
options.admin_password = ansible_module.params.get('password')
|
||||
@@ -156,7 +157,7 @@ def main():
|
||||
options.no_host_dns = ansible_module.params.get('no_host_dns')
|
||||
options.pki_config_override = ansible_module.params.get(
|
||||
'pki_config_override')
|
||||
### server ###
|
||||
# server
|
||||
options.setup_adtrust = ansible_module.params.get('setup_adtrust')
|
||||
options.setup_dns = ansible_module.params.get('setup_dns')
|
||||
options.setup_kra = ansible_module.params.get('setup_kra')
|
||||
@@ -165,8 +166,9 @@ def main():
|
||||
# no_hbac_allow
|
||||
options.no_pkinit = ansible_module.params.get('no_pkinit')
|
||||
# no_ui_redirect
|
||||
options.dirsrv_config_file = ansible_module.params.get('dirsrv_config_file')
|
||||
### ssl certificate ###
|
||||
options.dirsrv_config_file = ansible_module.params.get(
|
||||
'dirsrv_config_file')
|
||||
# ssl certificate
|
||||
options.dirsrv_cert_files = ansible_module.params.get('dirsrv_cert_files')
|
||||
options.http_cert_files = ansible_module.params.get('http_cert_files')
|
||||
options.pkinit_cert_files = ansible_module.params.get('pkinit_cert_files')
|
||||
@@ -176,7 +178,7 @@ def main():
|
||||
options.dirsrv_cert_name = ansible_module.params.get('dirsrv_cert_name')
|
||||
options.http_cert_name = ansible_module.params.get('http_cert_name')
|
||||
options.pkinit_cert_name = ansible_module.params.get('pkinit_cert_name')
|
||||
### client ###
|
||||
# client
|
||||
# mkhomedir
|
||||
options.ntp_servers = ansible_module.params.get('ntp_servers')
|
||||
options.ntp_pool = ansible_module.params.get('ntp_pool')
|
||||
@@ -185,7 +187,7 @@ def main():
|
||||
# no_ssh
|
||||
# no_sshd
|
||||
# no_dns_sshfp
|
||||
### certificate system ###
|
||||
# certificate system
|
||||
options.external_ca = ansible_module.params.get('external_ca')
|
||||
options.external_ca_type = ansible_module.params.get('external_ca_type')
|
||||
options.external_ca_profile = ansible_module.params.get(
|
||||
@@ -195,8 +197,9 @@ def main():
|
||||
options.subject_base = ansible_module.params.get('subject_base')
|
||||
options.ca_subject = ansible_module.params.get('ca_subject')
|
||||
# ca_signing_algorithm
|
||||
### dns ###
|
||||
options.allow_zone_overlap = ansible_module.params.get('allow_zone_overlap')
|
||||
# dns
|
||||
options.allow_zone_overlap = ansible_module.params.get(
|
||||
'allow_zone_overlap')
|
||||
options.reverse_zones = ansible_module.params.get('reverse_zones')
|
||||
options.no_reverse = ansible_module.params.get('no_reverse')
|
||||
options.auto_reverse = ansible_module.params.get('auto_reverse')
|
||||
@@ -207,30 +210,31 @@ def main():
|
||||
options.forward_policy = ansible_module.params.get('forward_policy')
|
||||
options.no_dnssec_validation = ansible_module.params.get(
|
||||
'no_dnssec_validation')
|
||||
### ad trust ###
|
||||
# ad trust
|
||||
options.enable_compat = ansible_module.params.get('enable_compat')
|
||||
options.netbios_name = ansible_module.params.get('netbios_name')
|
||||
options.rid_base = ansible_module.params.get('rid_base')
|
||||
options.secondary_rid_base = ansible_module.params.get('secondary_rid_base')
|
||||
options.secondary_rid_base = ansible_module.params.get(
|
||||
'secondary_rid_base')
|
||||
|
||||
### additional ###
|
||||
# additional
|
||||
options.kasp_db_file = None
|
||||
|
||||
# version specific ######################################################
|
||||
|
||||
if options.setup_adtrust and not adtrust_imported:
|
||||
#if "adtrust" not in options._allow_missing:
|
||||
# if "adtrust" not in options._allow_missing:
|
||||
ansible_module.fail_json(msg="adtrust can not be imported")
|
||||
#else:
|
||||
# options.setup_adtrust = False
|
||||
# ansible_module.warn(msg="adtrust is not supported, disabling")
|
||||
# else:
|
||||
# options.setup_adtrust = False
|
||||
# ansible_module.warn(msg="adtrust is not supported, disabling")
|
||||
|
||||
if options.setup_kra and not kra_imported:
|
||||
#if "kra" not in options._allow_missing:
|
||||
# if "kra" not in options._allow_missing:
|
||||
ansible_module.fail_json(msg="kra can not be imported")
|
||||
#else:
|
||||
# options.setup_kra = False
|
||||
# ansible_module.warn(msg="kra is not supported, disabling")
|
||||
# else:
|
||||
# options.setup_kra = False
|
||||
# ansible_module.warn(msg="kra is not supported, disabling")
|
||||
|
||||
if options.pki_config_override is not None:
|
||||
if PKIIniLoader is None:
|
||||
@@ -253,15 +257,6 @@ def main():
|
||||
if options.idmax is None or options.idmax == 0:
|
||||
options.idmax = options.idstart + 199999
|
||||
|
||||
#class ServerInstallInterface(ServerCertificateInstallInterface,
|
||||
# client.ClientInstallInterface,
|
||||
# ca.CAInstallInterface,
|
||||
# kra.KRAInstallInterface,
|
||||
# dns.DNSInstallInterface,
|
||||
# adtrust.ADTrustInstallInterface,
|
||||
# conncheck.ConnCheckInterface,
|
||||
# ServerUninstallInterface):
|
||||
|
||||
# ServerInstallInterface.__init__ #######################################
|
||||
try:
|
||||
self = options
|
||||
@@ -429,13 +424,6 @@ def main():
|
||||
except RuntimeError as e:
|
||||
ansible_module.fail_json(msg=e)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# #######################################################################
|
||||
|
||||
# If any of the key file options are selected, all are required.
|
||||
@@ -466,15 +454,15 @@ def main():
|
||||
|
||||
if not options.setup_dns:
|
||||
# lists
|
||||
for x in [ "forwarders", "reverse_zones" ]:
|
||||
for x in ["forwarders", "reverse_zones"]:
|
||||
if len(getattr(options, x)) > 1:
|
||||
ansible_module.fail_json(
|
||||
msg="You cannot specify %s without setting setup-dns" % x)
|
||||
# bool and str values
|
||||
for x in [ "auto_forwarders", "no_forwarders",
|
||||
"auto_reverse", "no_reverse", "no_dnssec_validation",
|
||||
"forward_policy" ]:
|
||||
if getattr(options, x) == True:
|
||||
for x in ["auto_forwarders", "no_forwarders",
|
||||
"auto_reverse", "no_reverse", "no_dnssec_validation",
|
||||
"forward_policy"]:
|
||||
if getattr(options, x):
|
||||
ansible_module.fail_json(
|
||||
msg="You cannot specify %s without setting setup-dns" % x)
|
||||
|
||||
@@ -483,7 +471,8 @@ def main():
|
||||
msg="You cannot specify forwarders together with no-forwarders")
|
||||
elif options.auto_forwarders and options.no_forwarders:
|
||||
ansible_module.fail_json(
|
||||
msg="You cannot specify auto-forwarders together with no-forwarders")
|
||||
msg="You cannot specify auto-forwarders together with "
|
||||
"no-forwarders")
|
||||
elif len(options.reverse_zones) > 0 and options.no_reverse:
|
||||
ansible_module.fail_json(
|
||||
msg="You cannot specify reverse-zones together with no-reverse")
|
||||
@@ -501,13 +490,13 @@ def main():
|
||||
ansible_module.fail_json(
|
||||
msg="You cannot specify external-ca-type without external-ca")
|
||||
|
||||
#if options.uninstalling:
|
||||
# if options.uninstalling:
|
||||
# if (options.realm_name or options.admin_password or
|
||||
# options.master_password):
|
||||
# ansible_module.fail_json(
|
||||
# msg="In uninstall mode, -a, -r and -P options are not "
|
||||
# "allowed")
|
||||
#elif not options.interactive:
|
||||
# elif not options.interactive:
|
||||
# if (not options.realm_name or not options.dm_password or
|
||||
# not options.admin_password):
|
||||
# ansible_module.fail_json(msg=
|
||||
@@ -532,9 +521,9 @@ def main():
|
||||
msg="You must specify at least one of forwarders, "
|
||||
"auto-forwarders or no-forwarders")
|
||||
|
||||
#any_ignore_option_true = any(
|
||||
# any_ignore_option_true = any(
|
||||
# [options.ignore_topology_disconnect, options.ignore_last_of_role])
|
||||
#if any_ignore_option_true and not options.uninstalling:
|
||||
# if any_ignore_option_true and not options.uninstalling:
|
||||
# ansible_module.fail_json(
|
||||
# msg="ignore-topology-disconnect and ignore-last-of-role "
|
||||
# "can be used only during uninstallation")
|
||||
@@ -569,8 +558,8 @@ def main():
|
||||
msg="File %s does not exist." % options.dirsrv_config_file)
|
||||
|
||||
# domain_name
|
||||
if (options.setup_dns and not options.allow_zone_overlap and \
|
||||
options.domain_name is not None):
|
||||
if options.setup_dns and not options.allow_zone_overlap and \
|
||||
options.domain_name is not None:
|
||||
try:
|
||||
check_zone_overlap(options.domain_name, False)
|
||||
except ValueError as e:
|
||||
@@ -599,8 +588,6 @@ def main():
|
||||
options.no_pkinit = True
|
||||
"""
|
||||
|
||||
|
||||
|
||||
if options.setup_dns:
|
||||
if len(options.forwarders) < 1 and not options.no_forwarders and \
|
||||
not options.auto_forwarders:
|
||||
@@ -610,7 +597,8 @@ def main():
|
||||
|
||||
if NUM_VERSION >= 40200 and options.master_password and \
|
||||
not options.external_cert_files:
|
||||
ansible_module.warn("Specifying kerberos master-password is deprecated")
|
||||
ansible_module.warn(
|
||||
"Specifying kerberos master-password is deprecated")
|
||||
|
||||
options._installation_cleanup = True
|
||||
if not options.external_ca and not options.external_cert_files and \
|
||||
@@ -669,7 +657,8 @@ def main():
|
||||
for path in options.external_cert_files:
|
||||
if not os.path.isabs(path):
|
||||
ansible_module.fail_json(
|
||||
msg="External cert file '%s' must use an absolute path" % path)
|
||||
msg="External cert file '%s' must use an absolute "
|
||||
"path" % path)
|
||||
|
||||
options.setup_ca = True
|
||||
# We only set up the CA if the PKCS#12 options are not given.
|
||||
@@ -679,14 +668,14 @@ def main():
|
||||
options.setup_ca = True
|
||||
|
||||
if not options.setup_ca and options.ca_subject:
|
||||
ansible_module.fail_json(msg=
|
||||
"--ca-subject cannot be used with CA-less installation")
|
||||
ansible_module.fail_json(
|
||||
msg="--ca-subject cannot be used with CA-less installation")
|
||||
if not options.setup_ca and options.subject_base:
|
||||
ansible_module.fail_json(msg=
|
||||
"--subject-base cannot be used with CA-less installation")
|
||||
ansible_module.fail_json(
|
||||
msg="--subject-base cannot be used with CA-less installation")
|
||||
if not options.setup_ca and options.setup_kra:
|
||||
ansible_module.fail_json(msg=
|
||||
"--setup-kra cannot be used with CA-less installation")
|
||||
ansible_module.fail_json(
|
||||
msg="--setup-kra cannot be used with CA-less installation")
|
||||
|
||||
# This will override any settings passed in on the cmdline
|
||||
if os.path.isfile(paths.ROOT_IPA_CACHE):
|
||||
@@ -698,7 +687,8 @@ def main():
|
||||
options.external_ca = False
|
||||
options.interactive = False
|
||||
except Exception as e:
|
||||
ansible_module.fail_json(msg="Cannot process the cache file: %s" % str(e))
|
||||
ansible_module.fail_json(
|
||||
msg="Cannot process the cache file: %s" % str(e))
|
||||
|
||||
# ca_subject
|
||||
if options.ca_subject:
|
||||
@@ -715,7 +705,8 @@ def main():
|
||||
if not options.external_ca and not options.external_cert_files and \
|
||||
is_ipa_configured():
|
||||
_installation_cleanup = False
|
||||
ansible_module.fail_json(msg="IPA server is already configured on this system.")
|
||||
ansible_module.fail_json(
|
||||
msg="IPA server is already configured on this system.")
|
||||
|
||||
if not options.no_ntp:
|
||||
try:
|
||||
@@ -723,7 +714,7 @@ def main():
|
||||
except timeconf.NTPConflictingService as e:
|
||||
ansible_module.log(
|
||||
"WARNING: conflicting time&date synchronization service "
|
||||
"'%s' will be disabled in favor of chronyd" % \
|
||||
"'%s' will be disabled in favor of chronyd" %
|
||||
e.conflicting_service)
|
||||
except timeconf.NTPConfigurationError:
|
||||
pass
|
||||
@@ -731,7 +722,8 @@ def main():
|
||||
if hasattr(httpinstance, "httpd_443_configured"):
|
||||
# Check to see if httpd is already configured to listen on 443
|
||||
if httpinstance.httpd_443_configured():
|
||||
ansible_module.fail_json(msg="httpd is already configured to listen on 443.")
|
||||
ansible_module.fail_json(
|
||||
msg="httpd is already configured to listen on 443.")
|
||||
|
||||
if not options.external_cert_files:
|
||||
# Make sure the 389-ds ports are available
|
||||
@@ -765,7 +757,8 @@ def main():
|
||||
try:
|
||||
validate_domain_name(domain_name)
|
||||
except ValueError as e:
|
||||
ansible_module.fail_json(msg="Invalid domain name: %s" % unicode(e))
|
||||
ansible_module.fail_json(
|
||||
msg="Invalid domain name: %s" % unicode(e))
|
||||
else:
|
||||
domain_name = options.domain_name
|
||||
|
||||
@@ -795,7 +788,7 @@ def main():
|
||||
"Directory.")
|
||||
|
||||
# Do not ask for time source
|
||||
#if not options.no_ntp and not options.unattended and not (
|
||||
# if not options.no_ntp and not options.unattended and not (
|
||||
# options.ntp_servers or options.ntp_pool):
|
||||
# options.ntp_servers, options.ntp_pool = timeconf.get_time_source()
|
||||
|
||||
@@ -813,8 +806,8 @@ def main():
|
||||
|
||||
if options.http_cert_files:
|
||||
if options.http_pin is None:
|
||||
ansible_module.fail_json(msg=
|
||||
"Apache Server private key unlock password required")
|
||||
ansible_module.fail_json(
|
||||
msg="Apache Server private key unlock password required")
|
||||
http_pkcs12_file, http_pin, http_ca_cert = load_pkcs12(
|
||||
cert_files=options.http_cert_files,
|
||||
key_password=options.http_pin,
|
||||
@@ -825,8 +818,8 @@ def main():
|
||||
|
||||
if options.dirsrv_cert_files:
|
||||
if options.dirsrv_pin is None:
|
||||
ansible_module.fail_json(msg=
|
||||
"Directory Server private key unlock password required")
|
||||
ansible_module.fail_json(
|
||||
msg="Directory Server private key unlock password required")
|
||||
dirsrv_pkcs12_file, dirsrv_pin, dirsrv_ca_cert = load_pkcs12(
|
||||
cert_files=options.dirsrv_cert_files,
|
||||
key_password=options.dirsrv_pin,
|
||||
@@ -837,8 +830,8 @@ def main():
|
||||
|
||||
if options.pkinit_cert_files:
|
||||
if options.pkinit_pin is None:
|
||||
ansible_module.fail_json(msg=
|
||||
"Kerberos KDC private key unlock password required")
|
||||
ansible_module.fail_json(
|
||||
msg="Kerberos KDC private key unlock password required")
|
||||
pkinit_pkcs12_file, pkinit_pin, pkinit_ca_cert = load_pkcs12(
|
||||
cert_files=options.pkinit_cert_files,
|
||||
key_password=options.pkinit_pin,
|
||||
@@ -847,36 +840,36 @@ def main():
|
||||
realm_name=realm_name)
|
||||
pkinit_pkcs12_info = (pkinit_pkcs12_file.name, pkinit_pin)
|
||||
|
||||
if (options.http_cert_files and options.dirsrv_cert_files and
|
||||
http_ca_cert != dirsrv_ca_cert):
|
||||
ansible_module.fail_json(msg=
|
||||
"Apache Server SSL certificate and Directory Server SSL "
|
||||
if options.http_cert_files and options.dirsrv_cert_files and \
|
||||
http_ca_cert != dirsrv_ca_cert:
|
||||
ansible_module.fail_json(
|
||||
msg="Apache Server SSL certificate and Directory Server SSL "
|
||||
"certificate are not signed by the same CA certificate")
|
||||
|
||||
if (options.http_cert_files and options.pkinit_cert_files and
|
||||
http_ca_cert != pkinit_ca_cert):
|
||||
ansible_module.fail_json(msg=
|
||||
"Apache Server SSL certificate and PKINIT KDC "
|
||||
if options.http_cert_files and options.pkinit_cert_files and \
|
||||
http_ca_cert != pkinit_ca_cert:
|
||||
ansible_module.fail_json(
|
||||
msg="Apache Server SSL certificate and PKINIT KDC "
|
||||
"certificate are not signed by the same CA certificate")
|
||||
|
||||
# done ##################################################################
|
||||
|
||||
ansible_module.exit_json(changed=False,
|
||||
ipa_python_version=IPA_PYTHON_VERSION,
|
||||
### basic ###
|
||||
# basic
|
||||
domain=options.domain_name,
|
||||
realm=realm_name,
|
||||
hostname=host_name,
|
||||
_hostname_overridden=bool(options.host_name),
|
||||
no_host_dns=options.no_host_dns,
|
||||
### server ###
|
||||
# server
|
||||
setup_adtrust=options.setup_adtrust,
|
||||
setup_kra=options.setup_kra,
|
||||
setup_ca=options.setup_ca,
|
||||
idstart=options.idstart,
|
||||
idmax=options.idmax,
|
||||
no_pkinit=options.no_pkinit,
|
||||
### ssl certificate ###
|
||||
# ssl certificate
|
||||
_dirsrv_pkcs12_file=dirsrv_pkcs12_file,
|
||||
_dirsrv_pkcs12_info=dirsrv_pkcs12_info,
|
||||
_dirsrv_ca_cert=dirsrv_ca_cert,
|
||||
@@ -886,19 +879,20 @@ def main():
|
||||
_pkinit_pkcs12_file=pkinit_pkcs12_file,
|
||||
_pkinit_pkcs12_info=pkinit_pkcs12_info,
|
||||
_pkinit_ca_cert=pkinit_ca_cert,
|
||||
### certificate system ###
|
||||
# certificate system
|
||||
external_ca=options.external_ca,
|
||||
external_ca_type=options.external_ca_type,
|
||||
external_ca_profile=options.external_ca_profile,
|
||||
### ad trust ###
|
||||
# ad trust
|
||||
rid_base=options.rid_base,
|
||||
secondary_rid_base=options.secondary_rid_base,
|
||||
### client ###
|
||||
# client
|
||||
ntp_servers=options.ntp_servers,
|
||||
ntp_pool=options.ntp_pool,
|
||||
### additional ###
|
||||
# additional
|
||||
_installation_cleanup=_installation_cleanup,
|
||||
domainlevel=options.domainlevel)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user