mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-03-26 21:33:05 +00:00
Update permission README file and add tests for executing plugin with
`ipaapi_context` set to `client`.
A new test playbook can be found at:
tests/permission/test_permission_client_context.yml
The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
Due to differences in data returned when running in a client context,
some values had to be modified so that comparision works and an
unnecessary call to IPA API is executed.
38 lines
1.2 KiB
YAML
38 lines
1.2 KiB
YAML
---
|
|
- name: Test permission
|
|
hosts: ipaclients, ipaserver
|
|
become: no
|
|
gather_facts: no
|
|
|
|
tasks:
|
|
- name: Include FreeIPA facts.
|
|
include_tasks: ../env_freeipa_facts.yml
|
|
|
|
# Test will only be executed if host is not a server.
|
|
- name: Execute with server context in the client.
|
|
ipapermission:
|
|
ipaadmin_password: SomeADMINpassword
|
|
ipaapi_context: server
|
|
name: ThisShouldNotWork
|
|
register: result
|
|
failed_when: not (result.failed and result.msg is regex("No module named '*ipaserver'*"))
|
|
when: ipa_host_is_client
|
|
|
|
# Import basic module tests, and execute with ipa_context set to 'client'.
|
|
# If ipaclients is set, it will be executed using the client, if not,
|
|
# ipaserver will be used.
|
|
#
|
|
# With this setup, tests can be executed against an IPA client, against
|
|
# an IPA server using "client" context, and ensure that tests are executed
|
|
# in upstream CI.
|
|
|
|
- name: Test permission using client context, in client host.
|
|
import_playbook: test_permission.yml
|
|
when: groups['ipaclients']
|
|
vars:
|
|
ipa_test_host: ipaclients
|
|
|
|
- name: Test permission using client context, in server host.
|
|
import_playbook: test_permission.yml
|
|
when: groups['ipaclients'] is not defined or not groups['ipaclients']
|