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:
Thomas Woerner
2021-08-19 17:40:38 +02:00
parent 5fd4a0c5a6
commit b8488cb933
3 changed files with 40 additions and 1 deletions

View File

@@ -580,6 +580,28 @@
register: result
failed_when: result.changed or result.failed
# ENSURE SIMPLE HOSTNAMES MATCH
- name: Ensure HBAC rule hbacrule01 simple host members are usable
ipahbacrule:
ipaadmin_password: SomeADMINpassword
name: hbacrule01
host:
- "testhost01"
- "testhost03"
register: result
failed_when: not result.changed or result.failed
- name: Ensure HBAC rule hbacrule01 simple host members are usable again (and match)
ipahbacrule:
ipaadmin_password: SomeADMINpassword
name: hbacrule01
host:
- "testhost01"
- "testhost03"
register: result
failed_when: result.changed or result.failed
# CLEANUP TEST ITEMS
- name: Ensure test HBAC rule hbacrule01 is absent