mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-06-09 18:25:53 +00:00
New server management module
There is a new server management module placed in the plugins folder:
plugins/modules/ipaserver.py
The server module allows to ensure presence and absence of servers. The
module requires an existing server, the deployment of a new server can
not be done with the module.
DNSName has been added to ansible_freeipa_module in plugins/module_utils
as this is used for locations.
Here is the documentation for the module:
README-server.md
New example playbooks have been added:
playbooks/server/server-absent-continue.yml
playbooks/server/server-absent-force.yml
playbooks/server/server-absent-ignore_last_of_role.yml
playbooks/server/server-absent-ignore_topology_disconnect.yml
playbooks/server/server-absent.yml
playbooks/server/server-hidden.yml
playbooks/server/server-location.yml
playbooks/server/server-no-location.yml
playbooks/server/server-no-service-weight.yml
playbooks/server/server-not-hidden.yml
playbooks/server/server-present.yml
playbooks/server/server-service-weight.yml
New tests for the module:
tests/server/test_server.yml
Change in module_utils/ansible_freeipa_module:
DNSName is imported from ipapython.dnsutil and also added to __all__
This commit is contained in:
134
tests/server/test_server.yml
Normal file
134
tests/server/test_server.yml
Normal file
@@ -0,0 +1,134 @@
|
||||
---
|
||||
- name: Test server
|
||||
hosts: ipaserver
|
||||
become: true
|
||||
|
||||
tasks:
|
||||
|
||||
# CLEANUP TEST ITEMS
|
||||
|
||||
- name: Ensure server "{{ 'ipaserver.' + ipaserver_domain }}" without location
|
||||
ipaserver:
|
||||
ipaadmin_password: SomeADMINpassword
|
||||
name: "{{ 'ipaserver.' + ipaserver_domain }}"
|
||||
location: ""
|
||||
|
||||
- name: Ensure server "{{ 'ipaserver.' + ipaserver_domain }}" without service weight
|
||||
ipaserver:
|
||||
ipaadmin_password: SomeADMINpassword
|
||||
name: "{{ 'ipaserver.' + ipaserver_domain }}"
|
||||
service_weight: -1
|
||||
|
||||
- name: Ensure location "mylocation" is absent
|
||||
ipalocation:
|
||||
ipaadmin_password: SomeADMINpassword
|
||||
name: mylocation
|
||||
state: absent
|
||||
|
||||
# CREATE TEST ITEMS
|
||||
|
||||
- name: Ensure location "mylocation" is present
|
||||
ipalocation:
|
||||
ipaadmin_password: SomeADMINpassword
|
||||
name: mylocation
|
||||
register: result
|
||||
failed_when: not result.changed or result.failed
|
||||
|
||||
# TESTS
|
||||
|
||||
- name: Ensure server "{{ 'ipaserver.' + ipaserver_domain }}" is present
|
||||
ipaserver:
|
||||
ipaadmin_password: SomeADMINpassword
|
||||
name: "{{ 'ipaserver.' + ipaserver_domain }}"
|
||||
register: result
|
||||
failed_when: result.changed or result.failed
|
||||
|
||||
- name: Ensure server "{{ 'ipaserver.' + ipaserver_domain }}" with location "mylocation"
|
||||
ipaserver:
|
||||
ipaadmin_password: SomeADMINpassword
|
||||
name: "{{ 'ipaserver.' + ipaserver_domain }}"
|
||||
location: "mylocation"
|
||||
register: result
|
||||
failed_when: not result.changed or result.failed
|
||||
|
||||
- name: Ensure server "{{ 'ipaserver.' + ipaserver_domain }}" with location "mylocation" again
|
||||
ipaserver:
|
||||
ipaadmin_password: SomeADMINpassword
|
||||
name: "{{ 'ipaserver.' + ipaserver_domain }}"
|
||||
location: "mylocation"
|
||||
register: result
|
||||
failed_when: result.changed or result.failed
|
||||
|
||||
- name: Ensure server "{{ 'ipaserver.' + ipaserver_domain }}" without location
|
||||
ipaserver:
|
||||
ipaadmin_password: SomeADMINpassword
|
||||
name: "{{ 'ipaserver.' + ipaserver_domain }}"
|
||||
location: ""
|
||||
register: result
|
||||
failed_when: not result.changed or result.failed
|
||||
|
||||
- name: Ensure server "{{ 'ipaserver.' + ipaserver_domain }}" without location again
|
||||
ipaserver:
|
||||
ipaadmin_password: SomeADMINpassword
|
||||
name: "{{ 'ipaserver.' + ipaserver_domain }}"
|
||||
location: ""
|
||||
register: result
|
||||
failed_when: result.changed or result.failed
|
||||
|
||||
- name: Ensure server "{{ 'ipaserver.' + ipaserver_domain }}" with service weight 1
|
||||
ipaserver:
|
||||
ipaadmin_password: SomeADMINpassword
|
||||
name: "{{ 'ipaserver.' + ipaserver_domain }}"
|
||||
service_weight: 1
|
||||
register: result
|
||||
failed_when: not result.changed or result.failed
|
||||
|
||||
- name: Ensure server "{{ 'ipaserver.' + ipaserver_domain }}" with service weight 1 again
|
||||
ipaserver:
|
||||
ipaadmin_password: SomeADMINpassword
|
||||
name: "{{ 'ipaserver.' + ipaserver_domain }}"
|
||||
service_weight: 1
|
||||
register: result
|
||||
failed_when: result.changed or result.failed
|
||||
|
||||
- name: Ensure server "{{ 'ipaserver.' + ipaserver_domain }}" without service weight
|
||||
ipaserver:
|
||||
ipaadmin_password: SomeADMINpassword
|
||||
name: "{{ 'ipaserver.' + ipaserver_domain }}"
|
||||
service_weight: -1
|
||||
register: result
|
||||
failed_when: not result.changed or result.failed
|
||||
|
||||
- name: Ensure server "{{ 'ipaserver.' + ipaserver_domain }}" without service weight again
|
||||
ipaserver:
|
||||
ipaadmin_password: SomeADMINpassword
|
||||
name: "{{ 'ipaserver.' + ipaserver_domain }}"
|
||||
service_weight: -1
|
||||
register: result
|
||||
failed_when: result.changed or result.failed
|
||||
|
||||
# hidden requires an additional server, not tested
|
||||
|
||||
# absent requires an additional server, only sanity test with absent server
|
||||
|
||||
- name: Ensure server "{{ 'absent.' + ipaserver_domain }}" is absent
|
||||
ipaserver:
|
||||
ipaadmin_password: SomeADMINpassword
|
||||
name: "{{ 'absent.' + ipaserver_domain }}"
|
||||
state: absent
|
||||
register: result
|
||||
failed_when: result.changed or result.failed
|
||||
|
||||
# ignore_last_of_role requires an additional server, not tested
|
||||
|
||||
# ignore_topology_disconnect requires an additional server, not tested
|
||||
|
||||
# CLEANUP TEST ITEMS
|
||||
|
||||
- name: Ensure location "mylocation" is absent
|
||||
ipalocation:
|
||||
ipaadmin_password: SomeADMINpassword
|
||||
name: mylocation
|
||||
state: absent
|
||||
register: result
|
||||
failed_when: not result.changed or result.failed
|
||||
Reference in New Issue
Block a user