mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-05-06 13:23:14 +00:00
module_utils/ansible_ipa_server.py: New function ansible_module_get_parsed_ip_addresses
This methods creates a list of ipautil.CheckedIPAddress from the provided ip string list.
This commit is contained in:
@@ -217,3 +217,14 @@ def ds_init_info(ansible_log, fstore, domainlevel, dirsrv_config_file,
|
||||
setup_pkinit=not no_pkinit)
|
||||
|
||||
return ds
|
||||
|
||||
def ansible_module_get_parsed_ip_addresses(ansible_module,
|
||||
param='ip_addresses'):
|
||||
ip_addrs = [ ]
|
||||
for ip in ansible_module.params.get(param):
|
||||
try:
|
||||
ip_parsed = ipautil.CheckedIPAddress(ip)
|
||||
except Exception as e:
|
||||
ansible_module.fail_json(msg="Invalid IP Address %s: %s" % (ip, e))
|
||||
ip_addrs.append(ip_parsed)
|
||||
return ip_addrs
|
||||
|
||||
@@ -129,7 +129,8 @@ def main():
|
||||
|
||||
options.dm_password = ansible_module.params.get('dm_password')
|
||||
options.admin_password = ansible_module.params.get('password')
|
||||
options.ip_addresses = ansible_module.params.get('ip_addresses')
|
||||
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')
|
||||
|
||||
@@ -130,7 +130,8 @@ def main():
|
||||
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')
|
||||
options.ip_addresses = ansible_module.params.get('ip_addresses')
|
||||
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')
|
||||
|
||||
@@ -107,7 +107,8 @@ def main():
|
||||
options.realm_name = ansible_module.params.get('realm')
|
||||
options.host_name = ansible_module.params.get('hostname')
|
||||
|
||||
options.ip_addresses = ansible_module.params.get('ip_addresses')
|
||||
options.ip_addresses = ansible_module_get_parsed_ip_addresses(
|
||||
ansible_module)
|
||||
options.reverse_zones = ansible_module.params.get('reverse_zones')
|
||||
options.http_cert_files = ansible_module.params.get('http_cert_files')
|
||||
|
||||
|
||||
@@ -98,7 +98,8 @@ def main():
|
||||
options.realm_name = ansible_module.params.get('realm')
|
||||
options.host_name = ansible_module.params.get('hostname')
|
||||
|
||||
options.ip_addresses = ansible_module.params.get('ip_addresses')
|
||||
options.ip_addresses = ansible_module_get_parsed_ip_addresses(
|
||||
ansible_module)
|
||||
options.reverse_zones = ansible_module.params.get('reverse_zones')
|
||||
|
||||
options.setup_adtrust = ansible_module.params.get('setup_adtrust')
|
||||
|
||||
@@ -132,7 +132,8 @@ def main():
|
||||
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')
|
||||
options.ip_addresses = ansible_module.params.get('ip_addresses')
|
||||
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')
|
||||
|
||||
Reference in New Issue
Block a user