mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-03-26 21:33:05 +00:00
Indirect maps were not supported by ansible-freeipa ipaautomountmap.
This patch adds support for adding indirect automount maps using the
"parent" and "mount" parameters, if the map do not yet exist. An
existing map cannot be modified.
The "parent" parameter must match an existing automount map, and the
"mount" parameter is required if "parent" is used.
A new example playbook can be found at:
playbooks/automount/automount-map-indirect-map.yml
A new test playbook was added to test the feature:
tests/automount/test_automountmap_indirect.yml
144 lines
4.1 KiB
YAML
144 lines
4.1 KiB
YAML
---
|
|
- name: Test automountmap
|
|
hosts: "{{ ipa_test_host | default('ipaserver') }}"
|
|
become: no
|
|
gather_facts: no
|
|
|
|
tasks:
|
|
# setup environment
|
|
- name: Ensure test maps are absent
|
|
ipaautomountmap:
|
|
ipaadmin_password: SomeADMINpassword
|
|
location: TestIndirect
|
|
name:
|
|
- DirectMap
|
|
- IndirectMap
|
|
- IndirectMapDefault
|
|
- IndirectMapDefaultAbsolute
|
|
state: absent
|
|
|
|
- name: Ensure test location is present
|
|
ipaautomountlocation:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: TestIndirect
|
|
|
|
- name: Ensure parent map is present
|
|
ipaautomountmap:
|
|
ipaadmin_password: SomeADMINpassword
|
|
location: TestIndirect
|
|
name: DirectMap
|
|
|
|
# TESTS
|
|
- name: Mount point cannot start with '/' if parentmap is not 'auto.master'
|
|
ipaautomountmap:
|
|
ipaadmin_password: SomeADMINpassword
|
|
location: TestIndirect
|
|
name: IndirectMap
|
|
parentmap: DirectMap
|
|
mount: '/absolute/path/will/fail'
|
|
register: result
|
|
failed_when: not result.failed or 'mount point is relative to parent map' not in result.msg
|
|
|
|
- name: Ensure indirect map is present
|
|
ipaautomountmap:
|
|
ipaadmin_password: SomeADMINpassword
|
|
location: TestIndirect
|
|
name: IndirectMap
|
|
parentmap: DirectMap
|
|
mount: indirect
|
|
register: result
|
|
failed_when: result.failed or not result.changed
|
|
|
|
- name: Ensure indirect map is present, again
|
|
ipaautomountmap:
|
|
ipaadmin_password: SomeADMINpassword
|
|
location: TestIndirect
|
|
name: IndirectMap
|
|
parentmap: DirectMap
|
|
mount: indirect
|
|
register: result
|
|
failed_when: result.failed or result.changed
|
|
|
|
- name: Ensure indirect map is absent
|
|
ipaautomountmap:
|
|
ipaadmin_password: SomeADMINpassword
|
|
location: TestIndirect
|
|
name: IndirectMap
|
|
state: absent
|
|
register: result
|
|
failed_when: result.failed or not result.changed
|
|
|
|
- name: Ensure indirect map is absent, again
|
|
ipaautomountmap:
|
|
ipaadmin_password: SomeADMINpassword
|
|
location: TestIndirect
|
|
name: IndirectMap
|
|
state: absent
|
|
register: result
|
|
failed_when: result.failed or result.changed
|
|
|
|
- name: Ensure indirect map is present, after being deleted
|
|
ipaautomountmap:
|
|
ipaadmin_password: SomeADMINpassword
|
|
location: TestIndirect
|
|
name: IndirectMap
|
|
parentmap: DirectMap
|
|
mount: indirect
|
|
register: result
|
|
failed_when: result.failed or not result.changed
|
|
|
|
- name: Ensure indirect map is present, after being deleted, again
|
|
ipaautomountmap:
|
|
ipaadmin_password: SomeADMINpassword
|
|
location: TestIndirect
|
|
name: IndirectMap
|
|
parentmap: DirectMap
|
|
mount: indirect
|
|
register: result
|
|
failed_when: result.failed or result.changed
|
|
|
|
- name: Ensure indirect map is present with default parent (auto.master)
|
|
ipaautomountmap:
|
|
ipaadmin_password: SomeADMINpassword
|
|
location: TestIndirect
|
|
name: IndirectMapDefault
|
|
mount: indirect_with_default
|
|
register: result
|
|
failed_when: result.failed or not result.changed
|
|
|
|
- name: Ensure indirect map is present with default parent (auto.master), again
|
|
ipaautomountmap:
|
|
ipaadmin_password: SomeADMINpassword
|
|
location: TestIndirect
|
|
name: IndirectMapDefault
|
|
mount: indirect_with_default
|
|
register: result
|
|
failed_when: result.failed or result.changed
|
|
|
|
- name: Absolute paths must workd with 'auto.master'
|
|
ipaautomountmap:
|
|
ipaadmin_password: SomeADMINpassword
|
|
location: TestIndirect
|
|
name: IndirectMapDefaultAbsolute
|
|
mount: /valid/path/indirect_with_default
|
|
register: result
|
|
failed_when: result.failed or not result.changed
|
|
|
|
# Cleanup
|
|
- name: Ensure test maps are absent
|
|
ipaautomountmap:
|
|
ipaadmin_password: SomeADMINpassword
|
|
location: TestIndirect
|
|
name:
|
|
- DirectMap
|
|
- IndirectMap
|
|
- IndirectMapDefault
|
|
- IndirectMapDefaultAbsolute
|
|
state: absent
|
|
|
|
- name: Ensure test location is absent
|
|
ipaautomountlocation:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: TestIndirect
|
|
state: absent
|