1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

ipa_config: add user and group ojectclasses parameters (#7019)

* ipa_config: add user and group ojectclasses parameters

* fix typo

* add changelog fragments and fix version_added

* fix changelog fragment permissions

* Update changelogs/fragments/7019-ipa_config-user-and-group-objectclasses.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Dmitriy Usachev <dmitrii.usachev@hyperus.team>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Dmitriy Usachev 2023-08-07 23:00:14 +03:00 committed by GitHub
parent c1f2f126cf
commit 4fda040e9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 5 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- ipa_config - add module parameters to manage FreeIPA user and group objectclasses (https://github.com/ansible-collections/community.general/pull/7019).

View file

@ -40,6 +40,12 @@ options:
aliases: ["primarygroup"] aliases: ["primarygroup"]
type: str type: str
version_added: '2.5.0' version_added: '2.5.0'
ipagroupobjectclasses:
description: A list of group objectclasses.
aliases: ["groupobjectclasses"]
type: list
elements: str
version_added: '7.3.0'
ipagroupsearchfields: ipagroupsearchfields:
description: A list of fields to search in when searching for groups. description: A list of fields to search in when searching for groups.
aliases: ["groupsearchfields"] aliases: ["groupsearchfields"]
@ -91,6 +97,12 @@ options:
type: list type: list
elements: str elements: str
version_added: '2.5.0' version_added: '2.5.0'
ipauserobjectclasses:
description: A list of user objectclasses.
aliases: ["userobjectclasses"]
type: list
elements: str
version_added: '7.3.0'
ipausersearchfields: ipausersearchfields:
description: A list of fields to search in when searching for users. description: A list of fields to search in when searching for users.
aliases: ["usersearchfields"] aliases: ["usersearchfields"]
@ -235,11 +247,12 @@ class ConfigIPAClient(IPAClient):
def get_config_dict(ipaconfigstring=None, ipadefaultloginshell=None, def get_config_dict(ipaconfigstring=None, ipadefaultloginshell=None,
ipadefaultemaildomain=None, ipadefaultprimarygroup=None, ipadefaultemaildomain=None, ipadefaultprimarygroup=None,
ipagroupsearchfields=None, ipahomesrootdir=None, ipagroupsearchfields=None, ipagroupobjectclasses=None,
ipakrbauthzdata=None, ipamaxusernamelength=None, ipahomesrootdir=None, ipakrbauthzdata=None,
ipapwdexpadvnotify=None, ipasearchrecordslimit=None, ipamaxusernamelength=None, ipapwdexpadvnotify=None,
ipasearchtimelimit=None, ipaselinuxusermaporder=None, ipasearchrecordslimit=None, ipasearchtimelimit=None,
ipauserauthtype=None, ipausersearchfields=None): ipaselinuxusermaporder=None, ipauserauthtype=None,
ipausersearchfields=None, ipauserobjectclasses=None):
config = {} config = {}
if ipaconfigstring is not None: if ipaconfigstring is not None:
config['ipaconfigstring'] = ipaconfigstring config['ipaconfigstring'] = ipaconfigstring
@ -249,6 +262,8 @@ def get_config_dict(ipaconfigstring=None, ipadefaultloginshell=None,
config['ipadefaultemaildomain'] = ipadefaultemaildomain config['ipadefaultemaildomain'] = ipadefaultemaildomain
if ipadefaultprimarygroup is not None: if ipadefaultprimarygroup is not None:
config['ipadefaultprimarygroup'] = ipadefaultprimarygroup config['ipadefaultprimarygroup'] = ipadefaultprimarygroup
if ipagroupobjectclasses is not None:
config['ipagroupobjectclasses'] = ipagroupobjectclasses
if ipagroupsearchfields is not None: if ipagroupsearchfields is not None:
config['ipagroupsearchfields'] = ','.join(ipagroupsearchfields) config['ipagroupsearchfields'] = ','.join(ipagroupsearchfields)
if ipahomesrootdir is not None: if ipahomesrootdir is not None:
@ -267,6 +282,8 @@ def get_config_dict(ipaconfigstring=None, ipadefaultloginshell=None,
config['ipaselinuxusermaporder'] = '$'.join(ipaselinuxusermaporder) config['ipaselinuxusermaporder'] = '$'.join(ipaselinuxusermaporder)
if ipauserauthtype is not None: if ipauserauthtype is not None:
config['ipauserauthtype'] = ipauserauthtype config['ipauserauthtype'] = ipauserauthtype
if ipauserobjectclasses is not None:
config['ipauserobjectclasses'] = ipauserobjectclasses
if ipausersearchfields is not None: if ipausersearchfields is not None:
config['ipausersearchfields'] = ','.join(ipausersearchfields) config['ipausersearchfields'] = ','.join(ipausersearchfields)
@ -283,6 +300,7 @@ def ensure(module, client):
ipadefaultloginshell=module.params.get('ipadefaultloginshell'), ipadefaultloginshell=module.params.get('ipadefaultloginshell'),
ipadefaultemaildomain=module.params.get('ipadefaultemaildomain'), ipadefaultemaildomain=module.params.get('ipadefaultemaildomain'),
ipadefaultprimarygroup=module.params.get('ipadefaultprimarygroup'), ipadefaultprimarygroup=module.params.get('ipadefaultprimarygroup'),
ipagroupobjectclasses=module.params.get('ipagroupobjectclasses'),
ipagroupsearchfields=module.params.get('ipagroupsearchfields'), ipagroupsearchfields=module.params.get('ipagroupsearchfields'),
ipahomesrootdir=module.params.get('ipahomesrootdir'), ipahomesrootdir=module.params.get('ipahomesrootdir'),
ipakrbauthzdata=module.params.get('ipakrbauthzdata'), ipakrbauthzdata=module.params.get('ipakrbauthzdata'),
@ -293,6 +311,7 @@ def ensure(module, client):
ipaselinuxusermaporder=module.params.get('ipaselinuxusermaporder'), ipaselinuxusermaporder=module.params.get('ipaselinuxusermaporder'),
ipauserauthtype=module.params.get('ipauserauthtype'), ipauserauthtype=module.params.get('ipauserauthtype'),
ipausersearchfields=module.params.get('ipausersearchfields'), ipausersearchfields=module.params.get('ipausersearchfields'),
ipauserobjectclasses=module.params.get('ipauserobjectclasses'),
) )
ipa_config = client.config_show() ipa_config = client.config_show()
diff = get_config_diff(client, ipa_config, module_config) diff = get_config_diff(client, ipa_config, module_config)
@ -322,6 +341,8 @@ def main():
ipadefaultloginshell=dict(type='str', aliases=['loginshell']), ipadefaultloginshell=dict(type='str', aliases=['loginshell']),
ipadefaultemaildomain=dict(type='str', aliases=['emaildomain']), ipadefaultemaildomain=dict(type='str', aliases=['emaildomain']),
ipadefaultprimarygroup=dict(type='str', aliases=['primarygroup']), ipadefaultprimarygroup=dict(type='str', aliases=['primarygroup']),
ipagroupobjectclasses=dict(type='list', elements='str',
aliases=['groupobjectclasses']),
ipagroupsearchfields=dict(type='list', elements='str', ipagroupsearchfields=dict(type='list', elements='str',
aliases=['groupsearchfields']), aliases=['groupsearchfields']),
ipahomesrootdir=dict(type='str', aliases=['homesrootdir']), ipahomesrootdir=dict(type='str', aliases=['homesrootdir']),
@ -340,6 +361,8 @@ def main():
"hardened", "disabled"]), "hardened", "disabled"]),
ipausersearchfields=dict(type='list', elements='str', ipausersearchfields=dict(type='list', elements='str',
aliases=['usersearchfields']), aliases=['usersearchfields']),
ipauserobjectclasses=dict(type='list', elements='str',
aliases=['userobjectclasses']),
) )
module = AnsibleModule( module = AnsibleModule(