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

396 lines
14 KiB
Python
Raw Permalink Normal View History

2020-03-09 10:11:07 +01:00
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Fran Fitzpatrick <francis.x.fitzpatrick@gmail.com>
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
2020-03-09 10:11:07 +01:00
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
module: ipa_config
author: Fran Fitzpatrick (@fxfitz)
short_description: Manage Global FreeIPA Configuration Settings
description:
- Modify global configuration settings of a FreeIPA Server.
attributes:
check_mode:
support: full
diff_mode:
support: none
2020-03-09 10:11:07 +01:00
options:
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
ipaconfigstring:
description: Extra hashes to generate in password plug-in.
aliases: ["configstring"]
type: list
elements: str
choices: ["AllowNThash", "KDC:Disable Last Success", "KDC:Disable Lockout", "KDC:Disable Default Preauth for SPNs"]
version_added: '2.5.0'
2020-03-09 10:11:07 +01:00
ipadefaultloginshell:
description: Default shell for new users.
aliases: ["loginshell"]
type: str
ipadefaultemaildomain:
description: Default e-mail domain for new users.
aliases: ["emaildomain"]
type: str
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
ipadefaultprimarygroup:
description: Default group for new users.
aliases: ["primarygroup"]
type: str
version_added: '2.5.0'
ipagroupobjectclasses:
description: A list of group objectclasses.
aliases: ["groupobjectclasses"]
type: list
elements: str
version_added: '7.3.0'
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
ipagroupsearchfields:
description: A list of fields to search in when searching for groups.
aliases: ["groupsearchfields"]
type: list
elements: str
version_added: '2.5.0'
ipahomesrootdir:
description: Default location of home directories.
aliases: ["homesrootdir"]
type: str
version_added: '2.5.0'
ipakrbauthzdata:
description: Default types of PAC supported for services.
aliases: ["krbauthzdata"]
type: list
elements: str
choices: ["MS-PAC", "PAD", "nfs:NONE"]
version_added: '2.5.0'
ipamaxusernamelength:
description: Maximum length of usernames.
aliases: ["maxusernamelength"]
type: int
version_added: '2.5.0'
ipapwdexpadvnotify:
description: Notice of impending password expiration, in days.
aliases: ["pwdexpadvnotify"]
type: int
version_added: '2.5.0'
ipasearchrecordslimit:
description: Maximum number of records to search (-1 or 0 is unlimited).
aliases: ["searchrecordslimit"]
type: int
version_added: '2.5.0'
ipasearchtimelimit:
description: Maximum amount of time (seconds) for a search (-1 or 0 is unlimited).
aliases: ["searchtimelimit"]
type: int
version_added: '2.5.0'
ipaselinuxusermaporder:
description: The SELinux user map order (order in increasing priority of SELinux users).
aliases: ["selinuxusermaporder"]
type: list
elements: str
version_added: '3.7.0'
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
ipauserauthtype:
description:
- The authentication type to use by default.
- The choice V(idp) has been added in community.general 7.3.0.
- The choice V(passkey) has been added in community.general 8.1.0.
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
aliases: ["userauthtype"]
choices: ["password", "radius", "otp", "pkinit", "hardened", "idp", "passkey", "disabled"]
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
type: list
elements: str
version_added: '2.5.0'
ipauserobjectclasses:
description: A list of user objectclasses.
aliases: ["userobjectclasses"]
type: list
elements: str
version_added: '7.3.0'
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
ipausersearchfields:
description: A list of fields to search in when searching for users.
aliases: ["usersearchfields"]
type: list
elements: str
version_added: '2.5.0'
2020-03-09 10:11:07 +01:00
extends_documentation_fragment:
- community.general.ipa.documentation
- community.general.attributes
2020-03-09 10:11:07 +01:00
'''
EXAMPLES = r'''
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
- name: Ensure password plugin features DC:Disable Last Success and KDC:Disable Lockout are enabled
community.general.ipa_config:
ipaconfigstring: ["KDC:Disable Last Success", "KDC:Disable Lockout"]
ipa_host: localhost
ipa_user: admin
ipa_pass: supersecret
- name: Ensure the default login shell is bash
community.general.ipa_config:
2020-03-09 10:11:07 +01:00
ipadefaultloginshell: /bin/bash
ipa_host: localhost
ipa_user: admin
ipa_pass: supersecret
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
- name: Ensure the default e-mail domain is ansible.com
community.general.ipa_config:
2020-03-09 10:11:07 +01:00
ipadefaultemaildomain: ansible.com
ipa_host: localhost
ipa_user: admin
ipa_pass: supersecret
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
- name: Ensure the default primary group is set to ipausers
community.general.ipa_config:
ipadefaultprimarygroup: ipausers
ipa_host: localhost
ipa_user: admin
ipa_pass: supersecret
- name: Ensure the group search fields are set to 'cn,description'
community.general.ipa_config:
ipagroupsearchfields: ['cn', 'description']
ipa_host: localhost
ipa_user: admin
ipa_pass: supersecret
- name: Ensure the home directory location is set to /home
community.general.ipa_config:
ipahomesrootdir: /home
ipa_host: localhost
ipa_user: admin
ipa_pass: supersecret
- name: Ensure the default types of PAC supported for services is set to MS-PAC and PAD
community.general.ipa_config:
ipakrbauthzdata: ["MS-PAC", "PAD"]
ipa_host: localhost
ipa_user: admin
ipa_pass: supersecret
- name: Ensure the maximum user name length is set to 32
community.general.ipa_config:
ipamaxusernamelength: 32
ipa_host: localhost
ipa_user: admin
ipa_pass: supersecret
- name: Ensure the password expiration notice is set to 4 days
community.general.ipa_config:
ipapwdexpadvnotify: 4
ipa_host: localhost
ipa_user: admin
ipa_pass: supersecret
- name: Ensure the search record limit is set to 100
community.general.ipa_config:
ipasearchrecordslimit: 100
ipa_host: localhost
ipa_user: admin
ipa_pass: supersecret
- name: Ensure the search time limit is set to 2 seconds
community.general.ipa_config:
ipasearchtimelimit: 2
ipa_host: localhost
ipa_user: admin
ipa_pass: supersecret
- name: Ensure the default user auth type is password
community.general.ipa_config:
ipauserauthtype: ['password']
ipa_host: localhost
ipa_user: admin
ipa_pass: supersecret
- name: Ensure the user search fields is set to 'uid,givenname,sn,ou,title'
community.general.ipa_config:
ipausersearchfields: ['uid', 'givenname', 'sn', 'ou', 'title']
ipa_host: localhost
ipa_user: admin
ipa_pass: supersecret
- name: Ensure the SELinux user map order is set
community.general.ipa_config:
ipaselinuxusermaporder:
- "guest_u:s0"
- "xguest_u:s0"
- "user_u:s0"
- "staff_u:s0-s0:c0.c1023"
- "unconfined_u:s0-s0:c0.c1023"
ipa_host: localhost
ipa_user: admin
ipa_pass: supersecret
2020-03-09 10:11:07 +01:00
'''
RETURN = r'''
config:
description: Configuration as returned by IPA API.
returned: always
type: dict
'''
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec
from ansible.module_utils.common.text.converters import to_native
2020-03-09 10:11:07 +01:00
class ConfigIPAClient(IPAClient):
def __init__(self, module, host, port, protocol):
super(ConfigIPAClient, self).__init__(module, host, port, protocol)
def config_show(self):
return self._post_json(method='config_show', name=None)
def config_mod(self, name, item):
return self._post_json(method='config_mod', name=name, item=item)
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
def get_config_dict(ipaconfigstring=None, ipadefaultloginshell=None,
ipadefaultemaildomain=None, ipadefaultprimarygroup=None,
ipagroupsearchfields=None, ipagroupobjectclasses=None,
ipahomesrootdir=None, ipakrbauthzdata=None,
ipamaxusernamelength=None, ipapwdexpadvnotify=None,
ipasearchrecordslimit=None, ipasearchtimelimit=None,
ipaselinuxusermaporder=None, ipauserauthtype=None,
ipausersearchfields=None, ipauserobjectclasses=None):
2020-03-09 10:11:07 +01:00
config = {}
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
if ipaconfigstring is not None:
config['ipaconfigstring'] = ipaconfigstring
2020-03-09 10:11:07 +01:00
if ipadefaultloginshell is not None:
config['ipadefaultloginshell'] = ipadefaultloginshell
if ipadefaultemaildomain is not None:
config['ipadefaultemaildomain'] = ipadefaultemaildomain
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
if ipadefaultprimarygroup is not None:
config['ipadefaultprimarygroup'] = ipadefaultprimarygroup
if ipagroupobjectclasses is not None:
config['ipagroupobjectclasses'] = ipagroupobjectclasses
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
if ipagroupsearchfields is not None:
config['ipagroupsearchfields'] = ','.join(ipagroupsearchfields)
if ipahomesrootdir is not None:
config['ipahomesrootdir'] = ipahomesrootdir
if ipakrbauthzdata is not None:
config['ipakrbauthzdata'] = ipakrbauthzdata
if ipamaxusernamelength is not None:
config['ipamaxusernamelength'] = str(ipamaxusernamelength)
if ipapwdexpadvnotify is not None:
config['ipapwdexpadvnotify'] = str(ipapwdexpadvnotify)
if ipasearchrecordslimit is not None:
config['ipasearchrecordslimit'] = str(ipasearchrecordslimit)
if ipasearchtimelimit is not None:
config['ipasearchtimelimit'] = str(ipasearchtimelimit)
if ipaselinuxusermaporder is not None:
config['ipaselinuxusermaporder'] = '$'.join(ipaselinuxusermaporder)
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
if ipauserauthtype is not None:
config['ipauserauthtype'] = ipauserauthtype
if ipauserobjectclasses is not None:
config['ipauserobjectclasses'] = ipauserobjectclasses
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
if ipausersearchfields is not None:
config['ipausersearchfields'] = ','.join(ipausersearchfields)
2020-03-09 10:11:07 +01:00
return config
def get_config_diff(client, ipa_config, module_config):
return client.get_diff(ipa_data=ipa_config, module_data=module_config)
def ensure(module, client):
module_config = get_config_dict(
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
ipaconfigstring=module.params.get('ipaconfigstring'),
2020-03-09 10:11:07 +01:00
ipadefaultloginshell=module.params.get('ipadefaultloginshell'),
ipadefaultemaildomain=module.params.get('ipadefaultemaildomain'),
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
ipadefaultprimarygroup=module.params.get('ipadefaultprimarygroup'),
ipagroupobjectclasses=module.params.get('ipagroupobjectclasses'),
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
ipagroupsearchfields=module.params.get('ipagroupsearchfields'),
ipahomesrootdir=module.params.get('ipahomesrootdir'),
ipakrbauthzdata=module.params.get('ipakrbauthzdata'),
ipamaxusernamelength=module.params.get('ipamaxusernamelength'),
ipapwdexpadvnotify=module.params.get('ipapwdexpadvnotify'),
ipasearchrecordslimit=module.params.get('ipasearchrecordslimit'),
ipasearchtimelimit=module.params.get('ipasearchtimelimit'),
ipaselinuxusermaporder=module.params.get('ipaselinuxusermaporder'),
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
ipauserauthtype=module.params.get('ipauserauthtype'),
ipausersearchfields=module.params.get('ipausersearchfields'),
ipauserobjectclasses=module.params.get('ipauserobjectclasses'),
2020-03-09 10:11:07 +01:00
)
ipa_config = client.config_show()
diff = get_config_diff(client, ipa_config, module_config)
changed = False
new_config = {}
for module_key in diff:
if module_config.get(module_key) != ipa_config.get(module_key, None):
changed = True
new_config.update({module_key: module_config.get(module_key)})
if changed and not module.check_mode:
client.config_mod(name=None, item=new_config)
return changed, client.config_show()
def main():
argument_spec = ipa_argument_spec()
argument_spec.update(
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
ipaconfigstring=dict(type='list', elements='str',
choices=['AllowNThash',
'KDC:Disable Last Success',
'KDC:Disable Lockout',
'KDC:Disable Default Preauth for SPNs'],
aliases=['configstring']),
2020-03-09 10:11:07 +01:00
ipadefaultloginshell=dict(type='str', aliases=['loginshell']),
ipadefaultemaildomain=dict(type='str', aliases=['emaildomain']),
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
ipadefaultprimarygroup=dict(type='str', aliases=['primarygroup']),
ipagroupobjectclasses=dict(type='list', elements='str',
aliases=['groupobjectclasses']),
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
ipagroupsearchfields=dict(type='list', elements='str',
aliases=['groupsearchfields']),
ipahomesrootdir=dict(type='str', aliases=['homesrootdir']),
ipakrbauthzdata=dict(type='list', elements='str',
choices=['MS-PAC', 'PAD', 'nfs:NONE'],
aliases=['krbauthzdata']),
ipamaxusernamelength=dict(type='int', aliases=['maxusernamelength']),
ipapwdexpadvnotify=dict(type='int', aliases=['pwdexpadvnotify']),
ipasearchrecordslimit=dict(type='int', aliases=['searchrecordslimit']),
ipasearchtimelimit=dict(type='int', aliases=['searchtimelimit']),
ipaselinuxusermaporder=dict(type='list', elements='str',
aliases=['selinuxusermaporder']),
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
ipauserauthtype=dict(type='list', elements='str',
aliases=['userauthtype'],
choices=["password", "radius", "otp", "pkinit",
"hardened", "idp", "passkey", "disabled"]),
Added fields to the ipa_config module (#2116) * Added fields to the ipa_config module: ipadefaultprimarygroup, ipagroupsearchfields, ipahomesrootdir, ipamaxusernamelength, ipapwdexpadvnotify, ipasearchrecordslimit, ipasearchtimelimit, ipauserauthtype, ipausersearchfields * Fixed typos in documentation spec * Updated a field that was missing the version_added decoration * Add changelog fragment * Update plugins/modules/identity/ipa/ipa_config.py Cleanup example to be consistent with others. Co-authored-by: Felix Fontein <felix@fontein.de> * Cleanup example to be consistent with others. * Fixed changelog fragment * Updated punctuation in examples * Switched some elements to use int instead of str, and fixed duplicated example * Change type of field for ipauserauthtype to list of str, add support for ipaconfigstring and ipakrbauthzdata * Update fragment to represent adding support for ipaconfigstring and ipakrbauthzdata * Update changelogs/fragments/2116-add-fields-to-ipa-config-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Address review comments by making inputs into group search and user search fields a list of strings, even though IPA does not treat it as a multiselect field * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/identity/ipa/ipa_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Chris Costa <chris.costa@compellingtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-04-11 05:57:36 +02:00
ipausersearchfields=dict(type='list', elements='str',
aliases=['usersearchfields']),
ipauserobjectclasses=dict(type='list', elements='str',
aliases=['userobjectclasses']),
2020-03-09 10:11:07 +01:00
)
module = AnsibleModule(
argument_spec=argument_spec,
supports_check_mode=True
)
client = ConfigIPAClient(
module=module,
host=module.params['ipa_host'],
port=module.params['ipa_port'],
protocol=module.params['ipa_prot']
)
try:
client.login(
username=module.params['ipa_user'],
password=module.params['ipa_pass']
)
changed, user = ensure(module, client)
module.exit_json(changed=changed, user=user)
except Exception as e:
module.fail_json(msg=to_native(e), exception=traceback.format_exc())
if __name__ == '__main__':
main()