mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-06-11 11:15:55 +00:00
There is a new automount key module placed in the plugins folder:
plugins/modules/ipaautomountkey.py
The server module allows to ensure presence and absence of automount
keys. The module requires an existing automount location and map to
place the key within.
Here is the documentation for the module:
README-automountkey.md
New example playbooks have been added:
playbooks/automount/automount-key-absent.yaml
playbooks/automount/automount-key-present.yaml
New tests for the module:
tests/automount/test_automountkey.yml
181 lines
5.3 KiB
YAML
181 lines
5.3 KiB
YAML
---
|
|
- name: Test automountmap
|
|
hosts: ipaserver
|
|
become: true
|
|
gather_facts: false
|
|
|
|
tasks:
|
|
- name: ensure location TestLocation is absent
|
|
ipaautomountlocation:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: TestLocation
|
|
state: absent
|
|
|
|
# - name: ensure map TestMap is absent
|
|
# ipaautomountmap:
|
|
# ipaadmin_password: SomeADMINpassword
|
|
# name: TestMap
|
|
# location: TestLocation
|
|
# state: absent
|
|
#
|
|
# - name: ensure key TestKey is absent
|
|
# ipaautomountkey:
|
|
# ipaadmin_password: SomeADMINpassword
|
|
# automountlocationcn: TestLocation
|
|
# automountmapname: TestMap
|
|
# automountkey: TestKey
|
|
# state: absent
|
|
|
|
- name: create location TestLocation
|
|
ipaautomountlocation:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: TestLocation
|
|
state: present
|
|
|
|
- name: create map TestMap
|
|
ipaautomountmap:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: TestMap
|
|
location: TestLocation
|
|
desc: "this is a test map that should be deleted by the test"
|
|
|
|
### test the key creation, and modification
|
|
- name: ensure key TestKey is present
|
|
ipaautomountkey:
|
|
ipaadmin_password: SomeADMINpassword
|
|
automountlocationcn: TestLocation
|
|
automountmapname: TestMap
|
|
automountkey: TestKey
|
|
automountinformation: 192.168.122.1:/exports
|
|
state: present
|
|
register: result
|
|
failed_when: result.failed or not result.changed
|
|
|
|
- name: ensure key TestKey is present again
|
|
ipaautomountkey:
|
|
ipaadmin_password: SomeADMINpassword
|
|
automountlocationcn: TestLocation
|
|
automountmapname: TestMap
|
|
automountkey: TestKey
|
|
automountinformation: 192.168.122.1:/exports
|
|
state: present
|
|
register: result
|
|
failed_when: result.failed or result.changed
|
|
|
|
## modify the key
|
|
- name: ensure key TestKey information has been updated
|
|
ipaautomountkey:
|
|
ipaadmin_password: SomeADMINpassword
|
|
automountlocationcn: TestLocation
|
|
automountmapname: TestMap
|
|
automountkey: TestKey
|
|
automountinformation: 192.168.122.1:/nfsshare
|
|
state: present
|
|
register: result
|
|
failed_when: result.failed or not result.changed
|
|
|
|
- name: ensure key TestKey information has been updated again
|
|
ipaautomountkey:
|
|
ipaadmin_password: SomeADMINpassword
|
|
automountlocationcn: TestLocation
|
|
automountmapname: TestMap
|
|
automountkey: TestKey
|
|
automountinformation: 192.168.122.1:/nfsshare
|
|
state: present
|
|
register: result
|
|
failed_when: result.failed or result.changed
|
|
|
|
## modify the name
|
|
- name: ensure key TestKey has been renamed to NewKeyName
|
|
ipaautomountkey:
|
|
ipaadmin_password: SomeADMINpassword
|
|
automountlocationcn: TestLocation
|
|
automountmapname: TestMap
|
|
automountkey: TestKey
|
|
automountinformation: 192.168.122.1:/nfsshare
|
|
newname: NewKeyName
|
|
state: rename
|
|
register: result
|
|
failed_when: result.failed or not result.changed
|
|
|
|
- name: ensure key TestKey does not exist
|
|
ipaautomountkey:
|
|
ipaadmin_password: SomeADMINpassword
|
|
automountlocationcn: TestLocation
|
|
automountmapname: TestMap
|
|
automountkey: NewKeyName
|
|
automountinformation: 192.168.122.1:/nfsshare
|
|
state: present
|
|
register: result
|
|
failed_when: result.failed or result.changed
|
|
|
|
- name: ensure key NewKeyName does exist
|
|
ipaautomountkey:
|
|
ipaadmin_password: SomeADMINpassword
|
|
automountlocationcn: TestLocation
|
|
automountmapname: TestMap
|
|
automountkey: NewKeyName
|
|
automountinformation: 192.168.122.1:/nfsshare
|
|
state: present
|
|
register: result
|
|
failed_when: result.failed or result.changed
|
|
|
|
- name: ensure key TestKey has been renamed to NewKeyName again
|
|
ipaautomountkey:
|
|
ipaadmin_password: SomeADMINpassword
|
|
automountlocationcn: TestLocation
|
|
automountmapname: TestMap
|
|
automountkey: TestKey
|
|
automountinformation: 192.168.122.1:/nfsshare
|
|
newname: NewKeyName
|
|
state: rename
|
|
register: result
|
|
failed_when: result.failed or result.changed
|
|
|
|
- name: ensure failure when state=present and newname is not set
|
|
ipaautomountkey:
|
|
ipaadmin_password: SomeADMINpassword
|
|
automountlocationcn: TestLocation
|
|
automountmapname: TestMap
|
|
automountkey: TestKey
|
|
automountinformation: 192.168.122.1:/nfsshare
|
|
state: rename
|
|
register: result
|
|
failed_when: not result.failed
|
|
|
|
|
|
### cleanup after the tests
|
|
- name: ensure key NewKeyName is absent
|
|
ipaautomountkey:
|
|
ipaadmin_password: SomeADMINpassword
|
|
automountlocationcn: TestLocation
|
|
automountmapname: TestMap
|
|
automountkey: NewKeyName
|
|
state: absent
|
|
register: result
|
|
failed_when: result.failed or not result.changed
|
|
|
|
- name: ensure key TestKey is absent again
|
|
ipaautomountkey:
|
|
ipaadmin_password: SomeADMINpassword
|
|
automountlocationcn: TestLocation
|
|
automountmapname: TestMap
|
|
automountkey: NewKeyName
|
|
state: absent
|
|
register: result
|
|
failed_when: result.failed or result.changed
|
|
|
|
- name: ensure map TestMap is removed
|
|
ipaautomountmap:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: TestMap
|
|
location: TestLocation
|
|
state: absent
|
|
|
|
- name: ensure location TestLocation is removed
|
|
ipaautomountlocation:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: TestLocation
|
|
state: absent
|
|
|