mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-03-26 21:33:05 +00:00
As ansible-core 2.19 'upper' and 'lower' filters make lists into strings and these strings are not interpreted as lists when running the plugins, it is needed to use 'map(<filter>)' to apply the filter to all entries of a list. Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
235 lines
7.5 KiB
YAML
235 lines
7.5 KiB
YAML
---
|
|
- name: Test hbacsvcgroup member varying capitalization
|
|
hosts: "{{ ipa_test_host | default('ipaserver') }}"
|
|
become: no
|
|
gather_facts: no
|
|
|
|
vars:
|
|
hbacsvc_list:
|
|
- sVc1
|
|
- SvC2
|
|
|
|
tasks:
|
|
- name: Test hbacsvcgroup member case insnsitive
|
|
block:
|
|
- name: Ensure test hbacsvcgroup is absent
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
state: absent
|
|
|
|
- name: Ensure test HBAC services are present
|
|
ipahbacsvc:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: "{{ item }}"
|
|
with_items: "{{ hbacsvc_list }}"
|
|
|
|
- name: Ensure test hbacsvcgroup is present with duplicate hbacsvc
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
hbacsvc:
|
|
- sVc1
|
|
- SvC1
|
|
register: result
|
|
failed_when: not result.changed or result.failed
|
|
|
|
- name: Ensure test hbacsvc is absent from hbacsvcgroup, with duplicate hbacsvc
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
hbacsvc:
|
|
- sVc1
|
|
- SvC1
|
|
action: member
|
|
state: absent
|
|
register: result
|
|
failed_when: not result.changed or result.failed
|
|
|
|
- name: Check if test hbacsvc absent, again, from hbacsvcgroup, with duplicate hbacsvc, would trigger changes
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
hbacsvc:
|
|
- svC1
|
|
- SVC1
|
|
action: member
|
|
state: absent
|
|
check_mode: yes
|
|
register: result
|
|
failed_when: result.changed or result.failed
|
|
|
|
- name: Ensure test hbacsvcgroup is absent
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
state: absent
|
|
register: result
|
|
failed_when: not result.changed or result.failed
|
|
|
|
- name: Check if hbacsvcgroup with members would trigger changes, mixed case
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
hbacsvc: "{{ hbacsvc_list }}"
|
|
check_mode: yes
|
|
register: result
|
|
failed_when: not result.changed or result.failed
|
|
|
|
- name: Ensure hbacsvcgroup is present with members, mixed case
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
hbacsvc: "{{ hbacsvc_list }}"
|
|
register: result
|
|
failed_when: not result.changed or result.failed
|
|
|
|
- name: Check if hbacsvcgroup with members would not trigger changes, mixed case
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
hbacsvc: "{{ hbacsvc_list }}"
|
|
check_mode: yes
|
|
register: result
|
|
failed_when: result.changed or result.failed
|
|
|
|
- name: Ensure hbacsvcgroup is present with members, lowercase
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
hbacsvc: "{{ hbacsvc_list | map('lower') }}"
|
|
register: result
|
|
failed_when: result.changed or result.failed
|
|
|
|
- name: Ensure hbacsvcgroup is present with members, uppercase
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
hbacsvc: "{{ hbacsvc_list | map('upper') }}"
|
|
register: result
|
|
failed_when: result.changed or result.failed
|
|
|
|
- name: Ensure test hbacsvcgroup is absent
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
state: absent
|
|
|
|
- name: Ensure test hbacsvcgroup is present
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
|
|
- name: Check if hbacsvcgroup members would trigger changes, mixed case
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
hbacsvc: "{{ hbacsvc_list }}"
|
|
action: member
|
|
check_mode: yes
|
|
register: result
|
|
failed_when: not result.changed or result.failed
|
|
|
|
- name: Ensure hbacsvcgroup has members, mixed case
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
hbacsvc: "{{ hbacsvc_list }}"
|
|
action: member
|
|
register: result
|
|
failed_when: not result.changed or result.failed
|
|
|
|
- name: Check if hbacsvcgroup members would not trigger changes, mixed case
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
hbacsvc: "{{ hbacsvc_list }}"
|
|
action: member
|
|
check_mode: yes
|
|
register: result
|
|
failed_when: result.changed or result.failed
|
|
|
|
- name: Ensure hbacsvcgroup has members, lowercase
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
hbacsvc: "{{ hbacsvc_list | map('lower') }}"
|
|
action: member
|
|
register: result
|
|
failed_when: result.changed or result.failed
|
|
|
|
- name: Ensure hbacsvcgroup has members, uppercase
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
hbacsvc: "{{ hbacsvc_list | map('upper') }}"
|
|
action: member
|
|
register: result
|
|
failed_when: result.changed or result.failed
|
|
|
|
- name: Check if hbacsvcgroup members absence would trigger changes, uppercase
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
hbacsvc: "{{ hbacsvc_list | map('upper') }}"
|
|
action: member
|
|
state: absent
|
|
check_mode: yes
|
|
register: result
|
|
failed_when: not result.changed or result.failed
|
|
|
|
- name: Ensure hbacsvcgroup has members absent, uppercase
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
hbacsvc: "{{ hbacsvc_list | map('upper') }}"
|
|
action: member
|
|
state: absent
|
|
register: result
|
|
failed_when: not result.changed or result.failed
|
|
|
|
- name: Check if hbacsvcgroup members absence would not trigger changes, uppercase
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
hbacsvc: "{{ hbacsvc_list | map('upper') }}"
|
|
action: member
|
|
state: absent
|
|
check_mode: yes
|
|
register: result
|
|
failed_when: result.changed or result.failed
|
|
|
|
- name: Ensure hbacsvcgroup has members absent, mixed case
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
hbacsvc: "{{ hbacsvc_list }}"
|
|
action: member
|
|
state: absent
|
|
register: result
|
|
failed_when: result.changed or result.failed
|
|
|
|
- name: Ensure hbacsvcgroup has members absent, lowercase
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
hbacsvc: "{{ hbacsvc_list | map('lower') }}"
|
|
action: member
|
|
state: absent
|
|
register: result
|
|
failed_when: result.changed or result.failed
|
|
|
|
always:
|
|
- name: Ensure test hbac service group is absent
|
|
ipahbacsvcgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: testgroup
|
|
state: absent
|
|
|
|
- name: Ensure test hbac services are absent
|
|
ipahbacsvc:
|
|
ipaadmin_password: SomeADMINpassword
|
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
name: "{{ hbacsvc_list }}"
|
|
state: absent
|