Skip to content

Commit 72732e5

Browse files
committed
WIP: Enable AD DC tests using ipalab-config
ipalab-config allows the creation of complex IPA environments using rootless containers. The tool provides the means to create an environment where a trust can be set between IPA and Samba AD DC, which is similar enough to Windows AD DC to be used in ansible-freeipa testing. To start a test scenario run 'infra/scenario/start-scenario' passing the scenario configuration as parameter. A list of the containers created will be printed on the screen, and an inventory file will be create on the repository root with the name 'inventory-scenario.yml'. Test playbooks can be executed using this scenario, or it can be used along with 'pytest'. Only one scenario can be run at a single time. When the tests are finished, 'infra/scenario/stop-scenario' will cleanup the environment, and a new scenario can be started. The inventory file created will not be removed, but will be overwritten if a new scenario is created. Signed-off-by: Rafael Guterres Jeffman <[email protected]>
1 parent 06447df commit 72732e5

File tree

4 files changed

+83
-22
lines changed

4 files changed

+83
-22
lines changed

infra/scenarios/ipa-ad-trust.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# IPA trust to Samba AD DC.
2+
#
3+
# Steps to set trust on 'server':
4+
# # kinit admin <<< SomeADMINpassword
5+
# # ipa dnsforwardzone-add ad.ipa.test. --forwarder=192.168.13.250
6+
# # ipa trust-add ad.ipa.test --type ad --range-type ipa-ad-trust --two-way true --admin=Administrator --password <<< Secret123
7+
#
8+
# Create samba user on 'addc':
9+
# # samba-tool user create jdoe --given-name John --surname Doe
10+
#
11+
# Checking user on IPA server:
12+
#
13+
# # getent passwd [email protected]
14+
15+
#
16+
---
17+
lab_name: ipa-ad-trust
18+
subnet: "192.168.13.0/24"
19+
extra_data:
20+
- playbooks
21+
external:
22+
hosts:
23+
- name: addc
24+
hostname: dc.ad.ipa.test
25+
role: addc
26+
ip_address: 192.168.13.250
27+
options:
28+
forwarder: 192.168.13.100
29+
ipa_deployments:
30+
- name: ipa
31+
domain: linux.ipa.test
32+
admin_password: SomeADMINpassword
33+
dm_password: SomeDMpassword
34+
cluster:
35+
servers:
36+
- name: server
37+
capabilities: ["DNS", "AD", "KRA"]
38+
ip_address: 192.168.13.100
39+
vars:
40+
ipaserver_netbios_name: IPA
41+
ipaserver_idstart: 60000
42+
ipaserver_idmax: 62000
43+
ipaserver_rid_base: 63000
44+
ipaserver_secondary_rid_base: 70000
45+
# trust test vars
46+
winserver_domain: ad.ipa.test
47+
winserver_admin_password: Secret123
48+
winserver_ip: 192.168.13.250
49+
# external users vars
50+
test_ad_user: 'jdoe@DC'
51+
test_alt_user: '[email protected]'
52+
clients:
53+
- name: cli01
54+
dns: server

infra/scenarios/requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ipalab-config>=0.10.2
2+
podman-compose>=1.2.0

tests/group/test_group_client_context.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
ipaadmin_password: SomeADMINpassword
2424
ipaapi_context: client
2525
name: ThisShouldNotWork
26-
external_member: "{{ ad_user }}"
26+
external_member: "SomeUser@AD"
2727
external: true
2828
register: result
2929
failed_when: not (result.failed and result.msg == "Cannot use externalmember in client context.")

tests/idrange/test_idrange.yml

+26-21
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,18 @@
88
- name: Retrieve FreeIPA facts
99
ansible.builtin.include_tasks: ../env_freeipa_facts.yml
1010

11-
# CLEANUP TEST ITEMS
12-
- name: Remove test trust.
13-
ansible.builtin.include_tasks: ../tasks_remove_trust.yml
14-
when: trust_test_is_supported | default(false)
15-
16-
- name: Ensure testing idranges are absent
17-
ipaidrange:
18-
ipaadmin_password: SomeADMINpassword
19-
ipaapi_context: "{{ ipa_context | default(omit) }}"
20-
name:
21-
- "{{ adserver.realm }}_id_range"
22-
- local_id_range
23-
- ad_id_range
24-
- ad_posix_id_range
25-
continue: yes
26-
state: absent
27-
28-
# CREATE TEST ITEMS
29-
30-
# TESTS
31-
3211
# Test local idrange, only if ipa-adtrust-install was not executed.
3312
- name: Test local idrange
3413
block:
14+
- name: Ensure testing idranges are absent
15+
ipaidrange:
16+
ipaadmin_password: SomeADMINpassword
17+
ipaapi_context: "{{ ipa_context | default(omit) }}"
18+
name:
19+
- local_id_range
20+
continue: yes
21+
state: absent
22+
3523
- name: Ensure idrange with minimal attributes is present
3624
ipaidrange:
3725
ipaadmin_password: SomeADMINpassword
@@ -118,6 +106,23 @@
118106
- name: Execute idrange tests if trust test environment is supported
119107
when: trust_test_is_supported | default(false)
120108
block:
109+
# CLEANUP TEST ITEMS
110+
- name: Remove test trust.
111+
ansible.builtin.include_tasks: ../tasks_remove_trust.yml
112+
when: trust_test_is_supported | default(false)
113+
114+
- name: Ensure testing idranges are absent
115+
ipaidrange:
116+
ipaadmin_password: SomeADMINpassword
117+
ipaapi_context: "{{ ipa_context | default(omit) }}"
118+
name:
119+
- "{{ adserver.realm | default(omit) }}_id_range"
120+
- local_id_range
121+
- ad_id_range
122+
- ad_posix_id_range
123+
continue: yes
124+
state: absent
125+
121126
# Create trust with range_type: ipa-ad-trust
122127
- name: Create trust with range_type 'ipa-ad-trust'
123128
ansible.builtin.include_tasks: ../tasks_set_trust.yml

0 commit comments

Comments
 (0)