mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-05-07 13:53:23 +00:00
hbacrule: Create FQDN from single hostnames
Single hostnames can be used for hbacrule_add_host and will match fqdn in IPA internally. Simple host names have to be extended to be FQDN to be able to compare them for _host_add and _host_remove. Two new functions have been added to ansible_freeipa_module: - api_get_domain - Get the domain from the api - ensure_fqdn - Extend a single name with the domain This fixes #617 - hbacrule_add_host: already a member
This commit is contained in:
@@ -159,7 +159,8 @@ RETURN = """
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.ansible_freeipa_module import temp_kinit, \
|
||||
temp_kdestroy, valid_creds, api_connect, api_command, compare_args_ipa, \
|
||||
module_params_get, gen_add_del_lists, gen_add_list, gen_intersection_list
|
||||
module_params_get, gen_add_del_lists, gen_add_list, \
|
||||
gen_intersection_list, api_get_domain, ensure_fqdn
|
||||
|
||||
|
||||
def find_hbacrule(module, name):
|
||||
@@ -325,6 +326,14 @@ def main():
|
||||
ipaadmin_password)
|
||||
api_connect()
|
||||
|
||||
# Get default domain
|
||||
default_domain = api_get_domain()
|
||||
|
||||
# Ensure fqdn host names, use default domain for simple names
|
||||
if host is not None:
|
||||
_host = [ensure_fqdn(x, default_domain) for x in host]
|
||||
host = _host
|
||||
|
||||
commands = []
|
||||
|
||||
for name in names:
|
||||
|
||||
Reference in New Issue
Block a user