Add IPA version verification for ipaconfig's maxhostname tests.

The config attributte maxhostname is only available after IPA
version 4.8.0. The tests for this attribute are now protected to
not run if a previous IPA version is found.
This commit is contained in:
Rafael Guterres Jeffman
2020-08-21 16:27:43 -03:00
parent c2f68a3401
commit 39d5558bd2

View File

@@ -5,6 +5,8 @@
gather_facts: false gather_facts: false
tasks: tasks:
- include_tasks: ../env_freeipa_facts.yml
# Retrieve current configuration. # Retrieve current configuration.
- name: return current values of the global configuration options - name: return current values of the global configuration options
ipaconfig: ipaconfig:
@@ -45,15 +47,17 @@
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
pac_type: "" pac_type: ""
- name: set maxusername to 255
ipaconfig:
ipaadmin_password: SomeADMINpassword
maxusername: 255
- name: set maxhostname to 255 - name: set maxhostname to 255
block:
- ipaconfig:
ipaadmin_password: SomeADMINpassword
maxhostname: 255
when: ipa_version is version('4.8.0', '>=')
- name: set maxusername to 45
ipaconfig: ipaconfig:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
maxhostname: 255 maxusername: 45
- name: set pwdexpnotify to 0 - name: set pwdexpnotify to 0
ipaconfig: ipaconfig:
@@ -186,18 +190,19 @@
failed_when: result.changed failed_when: result.changed
- name: set maxhostname to 77 - name: set maxhostname to 77
ipaconfig: block:
ipaadmin_password: SomeADMINpassword - ipaconfig:
maxhostname: 77 ipaadmin_password: SomeADMINpassword
register: result maxhostname: 77
failed_when: not result.changed register: result
failed_when: not result.changed
- name: set maxhostname to 77, again - ipaconfig:
ipaconfig: ipaadmin_password: SomeADMINpassword
ipaadmin_password: SomeADMINpassword maxhostname: 77
maxhostname: 77 register: result
register: result failed_when: result.changed
failed_when: result.changed when: ipa_version is version('4.8.0', '>=')
- name: set pwdexpnotify to 17 - name: set pwdexpnotify to 17
ipaconfig: ipaconfig:
@@ -329,7 +334,6 @@
ipaconfig: ipaconfig:
ipaadmin_password: 'SomeADMINpassword' ipaadmin_password: 'SomeADMINpassword'
maxusername: '{{previousconfig.config.maxusername | default(omit)}}' maxusername: '{{previousconfig.config.maxusername | default(omit)}}'
maxhostname: '{{previousconfig.config.maxhostname | default(omit)}}'
homedirectory: '{{previousconfig.config.homedirectory | default(omit)}}' homedirectory: '{{previousconfig.config.homedirectory | default(omit)}}'
defaultshell: '{{previousconfig.config.defaultshell | default(omit)}}' defaultshell: '{{previousconfig.config.defaultshell | default(omit)}}'
defaultgroup: '{{previousconfig.config.defaultgroup | default(omit)}}' defaultgroup: '{{previousconfig.config.defaultgroup | default(omit)}}'
@@ -352,11 +356,17 @@
register: result register: result
failed_when: not result.changed failed_when: not result.changed
- name: reset maxhostname
block:
- ipaconfig:
ipaadmin_password: SomeADMINpassword
maxhostname: '{{previousconfig.config.maxhostname | default(omit)}}'
when: ipa_version is version('4.8.0', '>=')
- name: reset changed fields, again - name: reset changed fields, again
ipaconfig: ipaconfig:
ipaadmin_password: 'SomeADMINpassword' ipaadmin_password: 'SomeADMINpassword'
maxusername: '{{previousconfig.config.maxusername | default(omit)}}' maxusername: '{{previousconfig.config.maxusername | default(omit)}}'
maxhostname: '{{previousconfig.config.maxhostname | default(omit)}}'
homedirectory: '{{previousconfig.config.homedirectory | default(omit)}}' homedirectory: '{{previousconfig.config.homedirectory | default(omit)}}'
defaultshell: '{{previousconfig.config.defaultshell | default(omit)}}' defaultshell: '{{previousconfig.config.defaultshell | default(omit)}}'
defaultgroup: '{{previousconfig.config.defaultgroup | default(omit)}}' defaultgroup: '{{previousconfig.config.defaultgroup | default(omit)}}'
@@ -379,6 +389,13 @@
register: result register: result
failed_when: result.changed failed_when: result.changed
- name: reset maxhostname
block:
- ipaconfig:
ipaadmin_password: SomeADMINpassword
maxhostname: '{{previousconfig.config.maxhostname | default(omit)}}'
when: ipa_version is version('4.8.0', '>=')
# cleanup # cleanup
- name: cleanup test group - name: cleanup test group