mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-05-01 19:03:19 +00:00
Adding an option `groups` to create multiple groups in one operation.
Adding tests (present/absent/external/nonposix) with server and
client context.
Simple example of `groups` option:
```
tasks:
- name: Ensure 2 groups are present
ipagroup:
ipaadmin_password: SomeADMINpassword
groups:
- name: group1
- name: group2
```
Signed-off-by: Denis Karpelevich <dkarpele@redhat.com>
64 lines
2.1 KiB
YAML
64 lines
2.1 KiB
YAML
---
|
|
- name: Test group
|
|
hosts: ipaclients, ipaserver
|
|
become: no
|
|
gather_facts: no
|
|
|
|
tasks:
|
|
- name: Include FreeIPA facts.
|
|
ansible.builtin.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.
|
|
ipagroup:
|
|
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 group using client context, in client host.
|
|
ansible.builtin.import_playbook: test_group.yml
|
|
when: groups['ipaclients']
|
|
vars:
|
|
ipa_test_host: ipaclients
|
|
|
|
- name: Test group using client context, in server host.
|
|
ansible.builtin.import_playbook: test_group.yml
|
|
when: groups['ipaclients'] is not defined or not groups['ipaclients']
|
|
vars:
|
|
ipa_context: client
|
|
|
|
- name: Test groups using client context, in client host.
|
|
ansible.builtin.import_playbook: test_groups.yml
|
|
when: groups['ipaclients']
|
|
vars:
|
|
ipa_test_host: ipaclients
|
|
|
|
- name: Test groups using client context, in server host.
|
|
ansible.builtin.import_playbook: test_groups.yml
|
|
when: groups['ipaclients'] is not defined or not groups['ipaclients']
|
|
vars:
|
|
ipa_context: client
|
|
|
|
- name: Test groups with mixed types using client context, in client host.
|
|
ansible.builtin.import_playbook: test_groups_external_nonposix.yml
|
|
when: groups['ipaclients']
|
|
vars:
|
|
ipa_test_host: ipaclients
|
|
|
|
- name: Test groups with mixed types using client context, in server host.
|
|
ansible.builtin.import_playbook: test_groups_external_nonposix.yml
|
|
when: groups['ipaclients'] is not defined or not groups['ipaclients']
|
|
vars:
|
|
ipa_context: client
|