Compare commits

...

435 Commits

Author SHA1 Message Date
Rafael Guterres Jeffman
45700bc02b Merge pull request #1082 from t-woerner/fix_pwpolicy_maxsequence_test
pwpolicy test: Fix maxsequence test
2023-06-07 12:35:00 -03:00
Thomas Woerner
d04a12e522 pwpolicy test: Fix maxsequence test
The maxsequence test was testing maxrepeat. Therefore the typo reported
with https://github.com/freeipa/ansible-freeipa/pull/1081 was never
seen.

The test has been fixed.
2023-06-07 17:17:20 +02:00
Thomas Woerner
4e9ec11b23 Merge pull request #1081 from cutrightjm/patch-1
Fix typo in ipapwpolicy.py
2023-06-07 17:17:01 +02:00
Thomas Woerner
2d93051101 Merge pull request #1078 from rjeffman/ipapwpolicy_simple_attribute_test
ipapwpolicy: simplified and faster attribute verification
2023-06-07 17:12:36 +02:00
Jacob Cutright
1a7b279d78 Fix typo in ipapwpolicy.py
The 'maxsequence' attribute was never applied as there was a typo when
it was set. By fixing the field name, 'maxsequence' is correclty set.

The failure was not seen before due to missing tests. The tests will be
added in a separate PR.
2023-06-07 12:04:49 -03:00
Thomas Woerner
be228d1df3 Merge pull request #1094 from rjeffman/ci_disable_pytests
Upstream CI: Disable execution of pytest tests
2023-06-07 17:00:59 +02:00
Thomas Woerner
ce95c638be Merge pull request #1099 from rjeffman/roles_disallow_fqdn_domain_match
Don't allow the FQDN to match the domain on server installs
2023-06-07 16:56:06 +02:00
Thomas Woerner
876f39a6c5 Merge pull request #687 from yrro/ipacert
ipacert module
2023-06-07 16:54:47 +02:00
Rafael Guterres Jeffman
950840e050 Merge pull request #1101 from t-woerner/multiple_service_management
Multiple service management
2023-06-07 11:53:14 -03:00
Sam Morris
87e1edf575 New certificate management module.
There is a new certificate management module placed in the plugins
folder:

    plugins/modules/ipacert.py

The certificate module allows to request, revoke, release and retrieve
certificates for users, hosts and services.

Here is the documentation for the module:

    README-cert.md

New example playbooks have been added:

    playbooks/cert/cert-hold.yml
    playbooks/cert/cert-release.yml
    playbooks/cert/cert-request-host.yml
    playbooks/cert/cert-request-service.yml
    playbooks/cert/cert-request-user.yml
    playbooks/cert/cert-retrieve.yml
    playbooks/cert/cert-revoke.yml

New tests for the module can be found at:

    tests/cert/test_cert_client_context.yml
    tests/cert/test_cert_host.yml
    tests/cert/test_cert_service.yml
    tests/cert/test_cert_user.yml

The module has been co-authored by Sam Morris (@yrro) and Rafael
Guterres Jeffman (@rjeffman).
2023-06-07 11:35:25 -03:00
Thomas Woerner
09250cb2c5 ipaservice: Updated and new tests for certificates and multi service handling
The tests test_services_absent.yml, test_services_present.yml and
test_services_present_slice.yml have been updated to use in memory data
for testing instead of loading json files. This made is simpler to use
variables from the playbook for example for fqdn host names.

New tests for certificates with and without trailing new lines have been
added for single service and multiple service handling.
2023-06-07 13:36:48 +02:00
Thomas Woerner
872c9e4cb2 ipaservice: Add Denis Karpelevich to the authors header
Denis added the multi service handling code. Therefore he should be
listed in the file header.
2023-06-07 13:36:48 +02:00
Thomas Woerner
efe9c68600 ipaservice: Properly Handle certs with leading or trailing white space
Any leading or trailing whitespace is removed while adding the
certificates with serive_add_cert. To be able to compare the results
from service_show with the given certificates we have to remove the
white space also.
2023-06-07 13:36:28 +02:00
Denis Karpelevich
0d9873b81c Allow multiple services creation
Adding an option to create multiple services in one go.
Adding tests (present/absent/without_skip_host_check)

Copied from PR #1054

Signed-off-by: Denis Karpelevich <dkarpele@redhat.com>
2023-06-06 12:40:33 +02:00
Rafael Guterres Jeffman
5b91703bd7 Don't allow the FQDN to match the domain on server installs
If server FQDN matches the domain name, the installation will succeed,
but DNS records will not work. If 'setup_dns: true' is used, there will
be no A record for the host, only a NS record, and the PTR record will
point to the domain name.

Based on: https://github.com/freeipa/freeipa/pull/6853
Related to: https://pagure.io/freeipa/issue/9003
2023-06-05 12:56:47 -03:00
Rafael Guterres Jeffman
180afd7586 Merge pull request #1077 from rjeffman/update_gitignore
Make Git ignore temporary and output files.
2023-05-30 10:59:09 -03:00
Thomas Woerner
7f16914032 Merge pull request #1097 from rjeffman/fix_ansible_lint_var_naming
upstream CI: Disable ansible-lint var-naming check
2023-05-30 14:45:14 +02:00
Rafael Guterres Jeffman
306522acd8 upstream CI: Disable ansible-lint var-naming check
Latest ansible-lint version (6.16.1) started to raise an error when
variable names from within roles are not prefixed with  the role name.
Error: var-naming[no-role-prefix].

As Ansible sanity check does not enforce this, it will be disabled, for
now on ansible-freeipa's upstream CI.

A future effort to reduce the checks that are not being evaluated should
be done as preparation for future Ansible Galaxy and Automation Hub
requirements.
2023-05-16 16:08:51 -03:00
Rafael Guterres Jeffman
a155324188 Upstream CI: Disable execution of pytest tests.
The tests under 'tests/pytests' were a POC to bring tests that evaluate
the result of playbook execution on the IPA environment. This is
currently only implemented for dnszone tests, and similar test coverage
is obtained with other tests.

As there is an ongoing issue with Ansible's docker pluging
("the connection plugin 'docker' was not found"), which is stil under
investigation, by removing the pytest tests we'll remove the consistent
failures currently seen on upstream CI, and will not loose test
coverage, specially if we take into account downstream tests.

Also, a new version for the pytests will be available once multihost
testing is implemented for upstream.
2023-05-15 15:41:09 -03:00
Rafael Guterres Jeffman
8ec5b1fe21 Merge pull request #1092 from t-woerner/fix_requests_version_require_for_build_container
tests/azure/templates/build_container.yml: Quote requests with version
2023-05-08 11:41:38 -03:00
Thomas Woerner
316255d524 tests/azure/templates/build_container.yml: Quote requests with version
The version requirement for requests need to be quoted not to lead into
a pip install command issue.

This is related to PR #1089 (Pin requests to < 2.29 temporarily)
2023-05-08 16:28:20 +02:00
Rafael Guterres Jeffman
36b7a18e40 Merge pull request #1088 from t-woerner/fix_new_ansible_lint_disallowed_ignores
Fix new ansible lint disallowes ignores
2023-05-05 12:08:41 -03:00
Thomas Woerner
a32fcb3765 ansible_freeipa_module.py: Calm down ansible-test on print and sys.exit
The function exit_raw_json is a replacement for AnsibleModule.exit_json
without flterting out values for no_log parameters.

Ansible added checks for pylint to forbid print and also sys.exit and
fails with ansible-bad-function. As the check is not known outside of
ansible-test, the disable line needed also W0012:

    # pylint: disable=W0012,ansible-bad-function
2023-05-05 16:56:38 +02:00
Thomas Woerner
2d4cad6c1b ipaserver_test.py: Add missing default for random_serial_numbers
random_serial_numbers was missing the default value in the DOCMENTATION
section.
2023-05-05 16:56:38 +02:00
Thomas Woerner
a4b8e10a40 ansible-test: Do not use automatic field numbering specification
Automatic field numbering specification is not allowed by ansible-test.
2023-05-05 16:26:45 +02:00
Thomas Woerner
98681bd4d2 Use "#!/usr/bin/env python" for python shebang
ansible is not allowing to use "#!/usr/bin/python".

Due to a change in ansible-lint it is not possible to ignore the "bad"
shebang.
2023-05-05 16:26:45 +02:00
Thomas Woerner
2882e2426a Add -eu to all bash shebangs
ansible requires to either use "#!/bin/bash -eu" or "#!/bin/bash -eux"
for bash shebangs.
2023-05-05 16:26:45 +02:00
Thomas Woerner
f056775d95 Remove old or empty sanity ignore files
The old ignore file ignore-2.12.txt is not needed and used anymore. The
new files ignore-2.13.txt and ignore-2.14.txt are empty after
ansible-lint made nearly all ignores disallowed.

All the newly disallowed ignores need to be fixed.

See https://github.com/ansible/ansible-lint/pull/3102
2023-05-05 16:26:45 +02:00
Rafael Guterres Jeffman
ad5450cd6f Merge pull request #1089 from t-woerner/pin_requests_below_2_29
Pin requests to < 2.29 temporarily
2023-05-05 11:25:39 -03:00
Thomas Woerner
e75d82131d Pin requests to < 2.29 temporarily
Due to https://github.com/docker/docker-py/issues/3113 requests need to
be pinned below 2.29 as a temporary solution.
2023-05-05 15:06:38 +02:00
Rafael Guterres Jeffman
99e468ad60 Merge pull request #1083 from t-woerner/fix_azure_molecule_docker
tests/azure: Install molecule-plguins to get docker driver
2023-04-27 17:45:35 -03:00
Thomas Woerner
3cc111782c tests/azure: Install molecule-plguins to get docker driver
The docker driver is not part of molecule 5.0.0 anymore.
molecule-plugins need to be installed to get the driver.
2023-04-27 14:01:09 +02:00
Rafael Guterres Jeffman
b429b4495e Merge pull request #1035 from t-woerner/new_module_github_user_fix
Fixes and enhancements for utils/new_module and templates
2023-04-20 10:03:19 -03:00
Rafael Guterres Jeffman
0f99ef2199 Merge pull request #1080 from t-woerner/module_defaults
Create action group in collection for use with module_defaults
2023-04-20 10:03:10 -03:00
Thomas Woerner
1c8f1c28e1 utils/templates/test_module*.yml.in: Use generic module_defaults
The usage of module_defaults allows to reduce the size of the tests and
to have the needed information in the tasks only. The default values for the
parameters are automatically passed to the module by Ansible.

It is not possible to use a module group for module_defaults as this could
only be done with Ansible Collections. The tests are also used upstream and
downstream without a collection.

Without groups of a collection it is needed to add the defaults for all
modules separately.

Simple example:

    module_defaults:
      ipahost:
        ipaadmin_password: SomeADMINpassword
        ipaapi_context: "{{ ipa_context | default(omit) }}"

Several module example using YAML anchors and aliases:

    module_defaults:
      ipahost: &ipa_module_defaults
        ipaadmin_password: SomeADMINpassword
        ipaapi_context: "{{ ipa_context | default(omit) }}"
      ipauser: *ipa_module_defaults
      ipagroup: *ipa_module_defaults
2023-04-20 10:10:51 +02:00
Thomas Woerner
47d5211185 utils/templates/test_module*.yml.in: Better docs for become and gather_facts
The documentation for "become" and "gather_facts" has been updated to
make sure that these parameters are enabled only in new tests if it is
really needed.
2023-04-20 10:10:51 +02:00
Thomas Woerner
4a18ad03c8 utils/templates/{README*.md.in,test_module*.yml.in}: Use true and false
The values "yes" and "no" will not be valid in the future for bool
parameters. Therefore "yes" and "no" have been replaced by "true" and
"false".
2023-04-20 10:09:07 +02:00
Thomas Woerner
966797dbee utils/build-galaxy-release.sh: Create module action group
The module action group <collection-prefix>.modules is created
automatically while building the galaxy release.

The action group can be used for module_defaults in this way:

    module_defauls:
      group/<collection-prefix>.modules:
        ipaadmin_password: SomeADMINpassword

Example:

    module_defaults:
      group/freeipa.ansible_freeipa.modules:
        ipaadmin_password: SomeADMINpassword
        ipaapi_context: "{{ ipa_context | default(omit) }}"
    collections:
    - freeipa.ansible_freeipa
2023-04-20 10:04:41 +02:00
Thomas Woerner
892c0dd6f0 utils/galaxyfy.py: Handle module_defaults, match roles and modules
The section module_defaults was not handled by utils/galaxyfy.py, also
there was no verification that only roles and modules provided by
ansible-freeipa are matched for prepending the collection prefix.
2023-04-20 10:04:26 +02:00
Rafael Guterres Jeffman
645a234d92 Make Git ignore temporary and output files.
Ignore vim .swp files and files generated by creating ansible-freeipa
collection, when checking repository status.
2023-04-18 10:21:24 -03:00
Thomas Woerner
5cbc8b7ada New utils/facts.py: Provide facts about the repo like role and module lists
The list of modules and roles is needed in several scripts now,
therefore it makes sense to have one place for this.

Here are the current variables:

BASE_DIR:           Base directory of the repo
ROLES:              List of roles in the roles folder
MANAGEMENT_MODULES: List of management modules in the plugins/modules
                    folder
ROLES_MODULES:      List of modules in the roles/*/library folders
ALL_MODULES:        List of all modules, the management and the roles
                    modules

All lists are sorted.
2023-04-18 13:36:42 +02:00
Thomas Woerner
5e5fbd87bf utils/templates/ipamodule.py.in: Add missing bracket
The parameter argument spec of name was missing the closing bracket. The
bracket has been added.
2023-04-14 17:23:37 +02:00
Rafael Guterres Jeffman
35ded3bf53 utils/new_module: Ensure correct number of parameters for new_module
When testing the number parameters for new_module, the
`github_user` was not being taken into account.
2023-04-14 17:23:37 +02:00
Thomas Woerner
209c6365ea utils/new_module: Fix github_user test
new_module was always failing with "github_user is not valid". The wrong
variable was checked: $githubuser instead of $github_user.
2023-04-14 17:23:37 +02:00
Rafael Guterres Jeffman
a69446021b ipapwpolicy: simplified and faster attribute verification
Use a simpler and faster 'any()' test instead of creating two lists and
checking if resulting list is empty.
2023-04-11 18:45:49 -03:00
Varun Mylaraiah
b861a61857 Merge pull request #1073 from t-woerner/ipaserver_do_not_enable_RSN_by_default
ipaserver: Do not enable random serial numbers by default
2023-04-05 15:57:53 +05:30
Thomas Woerner
6faff2ac11 ipaserver: Do not enable random serial numbers by default
ipaserver_random_serial_numbers was enabled by default in
roles/ipaserver/defaults/main.yml. This should not be the default and
also resulted in issues in all IPA versions that do not support RSN.

The parameter now defaults to false.
2023-04-05 11:53:28 +02:00
Rafael Guterres Jeffman
82c0161245 Merge pull request #1072 from t-woerner/external_group_ipaexternalmember_fix
ipagroup: Fix ensuring external group group members (without trust-ad)
2023-04-04 17:56:11 -03:00
Thomas Woerner
ecab42b9f5 Merge pull request #1060 from rjeffman/ipaserver_random_serial_numbers
roles/ipaserver: Allow deployments with random serial numbers
2023-04-04 16:12:15 +02:00
Thomas Woerner
183ea7fd79 Merge pull request #1047 from dkarpele/dkarpele-1040
Update `EXAMPLE` sections for multiuser and multihost handling.
2023-04-04 16:00:21 +02:00
Rafael Guterres Jeffman
a4087a755b roles/ipaserver: Allow deployments with random serial numbers
Since FreeIPA version 4.10 it is possible to deploy servers that use
Random Serial Number v3 support for certificates.

This patch exposes the 'random_serial_numbers' parameter, as
'ipaserver_random_serial_numbers', allowing a user to have random serial
numbers enabled for the domain.

The use of random serial numbers is allowed on new installations only.
2023-04-04 10:35:07 -03:00
Thomas Woerner
fb3ff6d63d Merge pull request #1001 from dkarpele/dkarpele-879
[RFE] Allow multiple groups creation
2023-04-04 13:35:24 +02:00
Thomas Woerner
ee92d99243 ipagroup: Handle ensuring groups with mixed types without IPA fix 6741
Ensuring (adding) several groups with mixed types external, nonposix
and posix require to have a fix in IPA:

    FreeIPA issue: https://pagure.io/freeipa/issue/9349
    FreeIPA fix: https://github.com/freeipa/freeipa/pull/6741

The simple solution is to switch to client context for ensuring several
groups simply if the user was not explicitly asking for the server context
no matter if mixed types are used.
2023-04-04 13:13:41 +02:00
Denis Karpelevich
a649a8dfe1 [RFE] Allow multiple groups creation.
Adding an option `groups` to create multiple groups in one operation.
Adding tests (present/absent/external/nonposix) with server and
client context.
Simple example of `groups` option:
```
tasks:
- name: Ensure 2 groups are present
  ipagroup:
    ipaadmin_password: SomeADMINpassword
    groups:
    - name: group1
    - name: group2
```

Signed-off-by: Denis Karpelevich <dkarpele@redhat.com>
2023-04-04 13:13:40 +02:00
Thomas Woerner
80abf635c3 ipagroup: Fix ensuring external group group members (without trust-ad)
Due to an API misbehaviour in FreeIPA, ipaexternalmembers need to be
treated differently than other group members parameters. Even an empty
array triggers all tests for external members, including the check for
installed dcerpc bindings.

Therefore ipagroup module has been changed to not set ipaexternalmember
to an empty list if there are no external members to be added or
removed.
2023-04-03 15:00:47 +02:00
Rafael Guterres Jeffman
24e05d1df4 Merge pull request #1067 from t-woerner/ipaclient_ipaclient_defer_krb5_configuration_fix
ipaclient: Defer krb5 configuration fix
2023-03-30 16:32:16 -03:00
Rafael Guterres Jeffman
065e902182 Merge pull request #1068 from t-woerner/replica_server_uninstall_cleanup
ipareplica/server: Enable removal from domain with undeployment
2023-03-30 16:31:34 -03:00
Rafael Guterres Jeffman
96f5f5c86e Merge pull request #1069 from t-woerner/ansible_lint_fixes
Ansible lint fixes
2023-03-30 16:30:23 -03:00
Thomas Woerner
476d9d5057 ipareplica/server: Enable removal from domain with undeployment
New variables have been added to ipareplica and ipaserver role to enable
the removal from the domein with the undeployment.

`ipaserver_remove_from_domain`
This enables the removal of the server from the domain additionally to the
undeployment.

`ipaserver_remove_on_server`
The value defines the server/replica in the domain that will to be used to
remove the server/replica from the domain if
`ipaserver_ignore_topology_disconnect` and `ipaserver_remove_from_domain`
are enabled. Without the need to enable
`ipaserver_ignore_topology_disconnect`, the value will be automatically
detected using the replication agreements of the server/replica.

For the replica role it is possible to use the server variables, but
also the replica versions: `ipareplica_remove_from_domain` and
`ipareplica_remove_on_server`.

The already existing parameters `ipaserver_ignore_topology_disconnect` and
`ipaserver_ignore_last_of_role` have been added to the README files for
server and replica with descriptions. The same for the replica versions
of the parameters.

The ipareplica role is not calling the `ipa-server-install` anymore, it
is instead using (including) the server role for the task.

The new module `ipaserver_get_connected_server` has been added to the
server role to be able to get a connected server using the replication
agreements. This module is only used if
`ipaserver_ignore_topology_disconnect` is not needed.
2023-03-28 10:29:07 +02:00
Thomas Woerner
049024bbb2 tests/config/test_config_sid: Mark tasks as noqa 503
The latest ansible-lint failes for the tasks that are using
"when: sid_disabled.changed" with the error
"Tasks that run when changed should likely be handlers.". As
these tasks are tests and it would not make sense to use handlers here,
the tasks have been marked as noqa 503.
2023-03-27 12:29:30 +02:00
Thomas Woerner
ec03ad2bf9 ipareplica/server: Always cleanup root IPA cache
The cleanup of the root IPA cache was depending on the result of the
ipaserver_enable_ipa and ipareplica_enable_ipa tasks. Instead of
"when: something.changed" a handler should be used instead. As
"/root/.ipa_cache" should be removed always (same in command line) the
removal of the file has been moded into the always section and does not
need a when anymore.
2023-03-27 12:24:02 +02:00
Thomas Woerner
64c43c1ec0 ipaclient_configure_dns_resolver: Removed bad aliases
The parameters nameservers and searchdomains had both the alias "cn".
Both aliases have been removed.
2023-03-27 12:21:37 +02:00
Thomas Woerner
b1eb32993d ipapwpolicy: The alias for usercheck in argument_spec had typo
The alias for usercheck in argument_spec was "ipapwusercheck" instead of
"ipapwdusercheck".
2023-03-27 12:20:14 +02:00
Thomas Woerner
2ee7139560 ipanetgroup: Missing type for action and state DOCUMENTATION section
The types for the parameters action and state have been missing in the
DOCUMENTATION section of the module.
2023-03-27 12:17:38 +02:00
Thomas Woerner
10d072a8c4 ipaclient: ipaclient_fix_ca also needs krb_name parameter
With the fix to defer creating the final krb5.conf on clients a bug has
been introduced with ipaclient_fix_ca: The krb_name parameter that
points to the temporary krb5 configuration was not added to the module

Without this the server affinity is broken for allow_repair and additionally
ipaclient_fix_ca could fail if krb5 configuration needs to be repraied
and also CA needs to be fixed.

The krb_name parameter has been added to ipaclient_fix_ca and is also
properly set in tasks/install.yml.
2023-03-24 12:51:59 +01:00
Thomas Woerner
0ec89eb53c ipaclient: ipaclient_setup_nss also needs krb_name parameter
With the fix to defer creating the final krb5.conf on clients a bug has
been introduced with ipaclient_setup_nss: The krb_name parameter that
points to the temporary krb5 configuration was not added to the module.

With a properly configured DNS (like for example IPA DNS) the krb TXT
records have been present in the DNS configuration. These have been used
automatically as a fallback and broke server affinity for the client.
Without the TXT records creating the IPA NSS database failed with
 "Cannot find KDC for realm ..".

The krb_name parameter has been added to ipaclient_setup_nss and is also
properly set in tasks/install.yml.
2023-03-24 12:37:48 +01:00
Thomas Woerner
cf27a98c61 Merge pull request #1045 from rjeffman/ipauser_param_description
ipauser: Better description of UID and GID parameters
2023-03-20 14:09:39 +01:00
Thomas Woerner
fd3e87771a Merge pull request #1062 from rjeffman/ipareplica_remove_undefined_params
ipareplica role: Remove usage of undefined parameters.
2023-03-20 13:42:30 +01:00
Rafael Guterres Jeffman
e03752955f ipareplica role: Remove usage of undefined parameters.
Some ipareplica role had a few module calls with parameters set like
'some_argument | default(omit)' that were not actually available in such
modules. If a user provided 'some_argument', the paramater would then
be passed to the module and ipareplica deployment would fail.

By removing the parameters from the 'install' task, ipareplica
deployment works even if the variables are set by the user.
2023-03-16 22:28:29 -03:00
Rafael Guterres Jeffman
338df6e60e Merge pull request #1058 from t-woerner/ipahost_make_return_value_depending_on_hosts_param
ipahost: Make return value depending on hosts parameter
2023-03-16 10:10:26 -03:00
Thomas Woerner
3f3e495ab3 ipahost: Make return value depending on hosts parameter
The way how randompasswords are returned by the ipahost module depends
so far on the number of hosts that are handled by the module.

This is unexpected if for example a json file is provided with the hosts
parameter. As it might be unknown how many hosts are in the json file,
this behaviour is unexpected. The return should not vary in this case.

This chamge makes the return simply depend on the use of the hosts
paramater. As soon as this parameter is used, the return will always be:

"host": { "<the host>": { "randompassword": "<the host random password>" } }

In the simply case with one host it will be still

"host": { "randompassword": "<the host random password>" }

This change for ipahost is related to the ipauser PR #1053.
2023-03-14 12:56:33 +01:00
Rafael Guterres Jeffman
b05aec98c5 Merge pull request #1053 from t-woerner/ipauer_make_return_value_depending_on_users_parameter
ipauser: Make return value depending on users parameter
2023-03-10 08:26:35 -03:00
Rafael Guterres Jeffman
867f7ed520 Merge pull request #1050 from t-woerner/ipaclient_defer_krb5_configuration
ipaclient: Defer creating the final krb5.conf on clients
2023-03-09 18:05:42 -03:00
Thomas Woerner
3cc17a43aa Merge pull request #974 from dkarpele/dkarpele-919
Add subid option to select the sssd profile with-subid.
2023-03-08 13:56:48 +01:00
Denis Karpelevich
2b0b7db086 Add subid option to select the sssd profile with-subid.
This is an ansible-freeipa update for the freeipa RFE:
https://pagure.io/freeipa/issue/9159
"`ipa-client-install` should provide option to enable `subid: sss`
in `/etc/nsswitch.conf`".

This option allows to configure authselect with the sssd
profile + with-subid feature, in order to have SSSD setup as
a datasource for subid in /etc/nsswitch.conf.

The default behavior remains unchanged: without the option,
/etc/nsswitch.conf keeps the line subid: files

Signed-off-by: Denis Karpelevich <dkarpele@redhat.com>
2023-03-06 16:06:33 +01:00
Thomas Woerner
87afc56ee6 Merge pull request #1051 from rjeffman/fedora-spdx
Migrated to SPDX license.
2023-03-02 13:55:13 +01:00
Thomas Woerner
61caa57801 ipauser: Make return value depending on users parameter
The way how randompasswords are returned by the ipauser module depends
so far on the number of users that are handled by the module.

This is unexpected if for example a json file is provided with the users
parameter. As it might be unknown how many users are in the json file,
this behaviour is unexpected. The return should not vary in this case.

This chamge makes the return simply depend on the use of the users
paramater. As soon as this parameter is used, the return will always be:

"user": { "<the user>": { "randompassword": "<the user random password>" } }

In the simply case with one user it will be still

"user": { "randompassword": "<the user random password>" }

Fixes: #1052 (ipauser should consitently return randompasswords when
              used with users)
2023-03-02 11:42:32 +01:00
Thomas Woerner
6b5acd9b0c ipaclient: Defer creating the final krb5.conf on clients
A temporary krb5 configuration was used to join the domain in
ipaclient_join. After that the final krkb5 configuration was created
with enabled DNS discovery and used for the remainaing tasks, where also
a connection to the IPA API was done.

With several servers the DNS discovery could have picked up a different
server. If the client deployment was faster than the replication this
could have lead to an unknown host error.

The issue was seen in performance testing where many simultaneous client
enrollments have been done..

The goal is to keep server affinity as long as possible within the
deployment process:

The temporary krb5.conf that was used before in ipaclient_join was
pulled out into an own module. The generated temporary krb5.conf is now
used in ipaclient_join and also ipaclient_api.

The generation of the final krb5.conf is moved to the end of the
deployment process.

Same as: https://pagure.io/freeipa/issue/9228

The setup of certmonger has been pulled out of ipaclient_setup_nss and moved
to the end of the process after generating the final krb5.conf as it will
use t will only use /etc/krb5.conf.

Certificate issuance may fail during deployment due to using the final
krb5.conf, but certmonger will re-try the request in this case.

Same as: https://pagure.io/freeipa/issue/9246
2023-02-27 16:09:34 +01:00
Denis Karpelevich
78b5e66da4 Update EXAMPLE sections for multiuser and multihost handling.
Signed-off-by: Denis Karpelevich <dkarpele@redhat.com>
2023-02-23 21:53:03 +01:00
Rafael Guterres Jeffman
f6c376a68f Migrated to SPDX license.
According to [1] all Fedora packages need to be updated to use a SPDX
expression. This patch updates the ansible-freeipa spec template to
comply with this change.

[1] https://fedoraproject.org/wiki/Changes/SPDX_Licenses_Phase_1
2023-02-23 17:27:33 -03:00
Rafael Guterres Jeffman
691fbd083e ipauser: Better description of UID and GID parameters
This patch provides better text for the description of UID and GID
parameters.
2023-02-23 14:50:11 -03:00
Thomas Woerner
77cd20bc10 Merge pull request #1046 from rjeffman/fix_ansible_lint_tests
Fix ansible-lint on tests
2023-02-22 14:24:37 +01:00
Rafael Guterres Jeffman
16ce5f21de ansible-lint: License must be defined as a list. 2023-02-21 11:26:29 -03:00
Rafael Guterres Jeffman
dcf9c7d8ce ansible-lint: Fixed dangling 'when' clause.
A dangling 'when:' clause was failing anisble-lint tests as the task did
not match any valid schema. The dangling clause was removed, and the
usage of 'shell' was changed from free form to use the 'cmd' parameter.
2023-02-21 11:26:29 -03:00
Rafael Guterres Jeffman
c715d3aad2 ansible-lint: Fix key order on upstream tests
In latest ansible-lint versions, the use of "blocks" has a required
order to be implemented. According to ansible-lint error mesage, the
order is name, when, block, rescue, always.

As not following this rule is now an error, this patch fixes all tests
for the 'key-order[task]' error.
2023-02-21 11:26:29 -03:00
Rafael Guterres Jeffman
0d1e9d3f49 ansible-lint: Use 'missing-import' instead of '505'
ansible-lint is issuing an warning when using '# noqa 505' instead of
'#noqa missing-import' on playbooks. This patch changes all occurrences
of the tag to use the newer format.
2023-02-21 11:26:29 -03:00
Rafael Guterres Jeffman
b30ae1c9b5 Merge pull request #1037 from t-woerner/fix_allow_repair_missing_krb5.conf_with_DNS_lookup
ipaclient: Fix allow_repair with removed krb5.conf and DNS lookup
2023-02-09 07:57:53 -03:00
Thomas Woerner
bfeefaf454 ipaclient: Fix allow_repair with removed krb5.conf and DNS lookup
The test in ipaclient_test_keytab is at first trying to use an existing
krb5.conf to test if the host keytab can be used. With working DNS lookup
an absent krb5.conf is not reported as an error as DNS lookup is
silently used instead.

A temporary krb5.conf is now used in this test that forces to deactivate
DNS lookups and also to load /etc/krb5.conf. A missing krb5.conf is now
detected properly as the kinit call fails now properly. Thanks to Julien
Rische for this proposal.

ipaclient_test_keytab is now properly returning the state of usable or
not usable krb5.conf in krb5_conf_ok. This fixes the handling of this
case later on in the role.
2023-02-08 16:14:38 +01:00
Rafael Guterres Jeffman
0c23ae5b37 Merge pull request #1033 from t-woerner/use_ipabackup_item_again
ipabackup: Use ipabackup_item again in copy_backup_to_server
2023-01-31 10:29:55 -03:00
Thomas Woerner
3b4367cf89 ipabackup: Use ipabackup_item again in copy_backup_to_server
ipabackup_item needs to be set again in copy_backup_to_server.yml. The
variable is later on used in restore.yml.
2023-01-31 10:16:53 +01:00
Thomas Woerner
e96f92c36f Merge pull request #1031 from rjeffman/ci_increase_timeout
upstream CI: increase Azure test timeout.
2023-01-23 20:07:38 +01:00
Rafael Guterres Jeffman
683a894876 upstream CI: increase Azure test timeout.
Due to DNS issues and the increase number of tests, the timeout setting
used for upstream tests was being reached. As we still have room for
running the tests using Azure infrastructure, this patch increases the
timeout to 240 minutes (4h), per worker.
2023-01-23 14:42:43 -03:00
Rafael Guterres Jeffman
2761c7e8d9 Merge pull request #1030 from t-woerner/use_yml_extension_for_pytest_tests
Use yml extension for pytest tests
2023-01-19 15:48:32 -03:00
Thomas Woerner
7d3921e510 Use yml extension for pytest tests
The pytest .yaml files have been rename to .yml to enable
build-galaxy-release to fix the prefix of the ansible-freeipa modules.
2023-01-19 16:07:42 +01:00
Thomas Woerner
6000aac687 Merge pull request #1029 from rjeffman/automount_tests_fix_ansible_lint
playbooks: Fix automount tasks to make ansible-lint happy
2023-01-18 09:45:17 +01:00
Thomas Woerner
e8354932b4 Merge pull request #1028 from rjeffman/dnszone_fix_typo
dnszone tests: Fix typo on task names.
2023-01-18 09:44:47 +01:00
Rafael Guterres Jeffman
a3089484b1 playbooks: Fix automount tasks to make ansible-lint happy
A few playbooks still had task name starting with lower case letters.
2023-01-17 14:24:09 -03:00
Rafael Guterres Jeffman
1469ac6058 dnszone tests: Fix typo on task names. 2023-01-17 14:00:28 -03:00
Rafael Guterres Jeffman
308d970b6c Merge pull request #1026 from t-woerner/ansible_lint_tests
Ansible lint tests
2023-01-17 12:02:50 -03:00
Rafael Guterres Jeffman
7b470ceb60 Merge pull request #1022 from t-woerner/pwpolicy_bool_checks
pwpolicy: Fix new bool checks for IPA prior to 4.9.10
2023-01-17 11:49:23 -03:00
Rafael Guterres Jeffman
77f5d8751f Merge pull request #1027 from t-woerner/use_yml_extension_for_all_automount_example_playbooks
playbooks/automount: All playbooks should use .yml
2023-01-17 09:45:17 -03:00
Thomas Woerner
3292252802 playbooks/automount: All playbooks should use .yml
The playbooks automount-map-absent.yaml and automount-map-present.yaml
have been using the wrong extention. The files have been renamed to use
.yml now.
2023-01-17 13:34:19 +01:00
Thomas Woerner
414dc06c86 ansible-lint: All names should start with an uppercase letter 2023-01-17 12:53:02 +01:00
Thomas Woerner
d2f9fe6325 Fix jinja2 white spaces issues reported by ansible-lint
This replaces double spaces by single spaces, fixes spaces in slices,
adds spaces before brackets and fixes bracket placing in when clauses.
2023-01-17 12:38:51 +01:00
Thomas Woerner
d7c02d1347 Improve jinja2 spacing: Remove space between join and ()
This change removes the space between join and (): "join ()" to "join()"
2023-01-17 11:51:38 +01:00
Thomas Woerner
cc6a80fa88 .github/workflows/lint.yml: Enable ansible-lint for the whole collection
The whole collection is tested with this change. Before it has been
limited to the roles and plugins folder.
2023-01-17 11:28:27 +01:00
Thomas Woerner
fe6edbabdb .ansible-lint: Deactivate experimental and name[template] tests
The experimental tests is running several additional tests like for
example to check module arg values. It fails everytime a variable is
used to pass the value in.

Examples:
- playbooks/topology/add-topologysegments.yml:15: args[module]: value of
  suffix must be one of: domain, ca, domain+ca, got: {{ item.suffix }}
- tests/host/test_host.yml:21: args[module]: value of ipaapi_context must
  be one of: server, client, got: {{ ipa_context | default(omit) }}

The name template test is failing for every template use inside of a name.
This is forcing to have only generic names and nothing specific in the
log anymore.

These two tests have been deactivated to have less overflow in the
ansible-lint output.
2023-01-17 11:20:10 +01:00
Rafael Guterres Jeffman
434905432d Merge pull request #1024 from rjeffman/pwpolicy_client_fix
pwpolicy: Fix tests for 'minlength: ""'
2023-01-16 22:44:51 -03:00
Rafael Guterres Jeffman
9f773ff5ac pwpolicy: Fix tests for 'minlength: ""'
When clearing minimum length parameter, FreeIPA raises an error, and the
error is different when executing the playbook in server or client
context. Since the error message is evaluated in the text, both errors
must be accepted as "not a failure", since ansible-freeipa did the
correct call.

Once https://pagure.io/freeipa/issue/9297 is fixed, the test must be
updated to not accept any of these error messages.
2023-01-16 21:33:46 -03:00
Rafael Guterres Jeffman
e95bec1803 Merge pull request #1023 from t-woerner/ansible_lint_needs_collection_source_dir
.github/workflows/lint.yml: ansible-lint needs collection source dir
2023-01-16 16:47:24 -03:00
Thomas Woerner
ea709ebc4d .github/workflows/lint.yml: ansible-lint needs collection source dir
ansible-lint required to be run in a collection source directory with
correct and working galaxy.yml

As ansible-freeipa is not converted to a collection, the galaxy.yml file
can not be used to create the collection. This needs to be done with
utils/build-galaxy-release.sh. The script is fixing all the prefixes for
the roles and modules in all the yml files and also example snippets and
in the documentation.

Therefore utils/build-galaxy-release.sh is called with the "-k" option
to keep the directory that has been used to generate the collection with
the script. Afterwards ansible-lint is run in this build directory.
2023-01-16 16:45:36 -03:00
Thomas Woerner
add89c25ee Merge pull request #1014 from rjeffman/roles_ansible_lint
Fix ansible-test lint warnings in roles.
2023-01-16 18:20:49 +01:00
Thomas Woerner
9108065ea7 pwpolicy: Fix new bool checks for IPA prior to 4.9.10
With 4.9.10, the value of bools have been changed from "TRUE" and
"FALSE" to real bool values.

With IPA < 4.9.10 the new bool checks distcheck and usercheck failed
the tests for enabling the checks with a "already enabled" error.

A new version check altogether with providing the ansible module for
gen_args has been added. The values True and False are now transformed
into "TRUE" and "FALSE" for IPA < 4.9.10.

The function bool_param has been renamed to bool_or_empty_param to match
the int_or_empty_param and to have a more explaining name.
2023-01-16 16:35:02 +01:00
Thomas Woerner
6cac891287 Merge pull request #977 from rjeffman/ci_update_ansible_2_14
upstream ci: Update Ansible versions on Azure pipelines.
2023-01-13 16:28:22 +01:00
Thomas Woerner
fc5fc9d9ef Merge pull request #1012 from rjeffman/pwpolicy_clean_values
pwpolicy: Allow clearing policy values.
2023-01-13 15:00:25 +01:00
Thomas Woerner
670740bdc0 Merge pull request #999 from rjeffman/update_tool_versions
Update development and Github workflow tools.
2023-01-13 14:53:49 +01:00
Rafael Guterres Jeffman
529deae407 ansible-lint: Fix file kind and ignores.
ansible-lint must ignore Azure configuration, and handle non-test files
with the proper kind (tasks or playbook).
2023-01-12 13:21:52 -03:00
Rafael Guterres Jeffman
a945862540 roles: Fix ansible-lint name:template warnings
ansible-lint warns if Jinja2 templates are not used as the last item in
a task name.
2023-01-12 13:13:31 -03:00
Rafael Guterres Jeffman
8240d9beb6 roles: Fix ansible-lint warning on var-naming.
ansible-lint warns if set_fact sets a variable where the name is used
or can be as a parameter for the role.
2023-01-12 12:49:41 -03:00
Rafael Guterres Jeffman
6da6110432 Fix issues raised by Flake8 version 5.0.3 2023-01-12 12:34:28 -03:00
Rafael Guterres Jeffman
1d8deb8e2d Fix issues raised by Pylint version 2.14.4. 2023-01-12 12:34:28 -03:00
Rafael Guterres Jeffman
b3856a1e2c Update Github workflow linter and check tools.
Update Github workflow tools to match the versions on Fedora 37.
2023-01-12 12:34:28 -03:00
Rafael Guterres Jeffman
410682a01d pwpolicy: Allow clearing policy values.
All values for pwpolicy can be cleared with an empty string in IPA CLI,
and this behavior was missing in ansible-freeipa.

As of today, there is an issue in FreeIPA that does not allow clearing
'minlength' policy. The is is tracked by the FreeIPA project through
https://pagure.io/freeipa/issue/9297

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2150334
2023-01-12 12:18:57 -03:00
Rafael Guterres Jeffman
ee59ec2142 upstream ci: Update Ansible versions on Azure pipelines.
As we now have ansible-core 2.14 available through 'pip', the versions
used for testing on Azure should be 2.12, 2.13 and 2.14, as Ansible
keeps upstream support for the latest version plus the two previous
ones.

This patch update the version used in tests by increasing the version
used by 1 (MINOR).
2023-01-11 19:00:13 -03:00
Rafael Guterres Jeffman
d043a3bdd1 Update development tools.
Update development tools to match Fedora 37 versions.
2023-01-11 18:38:37 -03:00
Rafael Guterres Jeffman
5062ac2b09 roles: Fix when, block and always key order.
ansible-lint warns if  'warn' key is used before block and always keys.
2023-01-11 14:37:39 -03:00
Rafael Guterres Jeffman
292e2eb60e roles: Fix jinja2 template spacing
This patch fixes ansible-lint warns on jinja2 template spacing in roles
2023-01-11 14:29:40 -03:00
Rafael Guterres Jeffman
baa7cae8bf roles: Fix task names to start with uppercase letters
ansible-lint warns if task names don't start with an uppercase letter.
2023-01-11 14:29:33 -03:00
Rafael Guterres Jeffman
6b7633976c roles: Fix use of ansible.builtin.fail free-form message.
ansible-lint warns to avoid using free-form when calling module actions
and ansible-freeipa roles used this form with 'ansible.builtin.fail'.
2023-01-11 14:27:59 -03:00
Rafael Guterres Jeffman
9a32359a5d roles: Fix type of data used for for versions in meta files
ansible-lint warns if version strings are used as numbers instead fo
strings.
2023-01-11 14:27:59 -03:00
Rafael Guterres Jeffman
82e176af95 Merge pull request #1013 from t-woerner/unnamed-tasks
yamllint: All tasks need to be named
2023-01-11 12:08:29 -03:00
Thomas Woerner
2a1ecdbd83 yamllint: All tasks need to be named
yamllint is failing for unnamed tasks. All block and include_tasks tasks
are now named.
2023-01-11 15:27:35 +01:00
Rafael Guterres Jeffman
f8b5851610 Merge pull request #1016 from t-woerner/galaxyfy_ansible_builtin
utils files: Support builtins with ansible.builtin. prefix
2023-01-09 17:54:23 -03:00
Thomas Woerner
b760863847 utils/get_test_modules.py: Support ansible.builtin. prefix
The ansible.builtin. prefix was not supported. Therefore tasks have not
been identified properly.
2023-01-09 18:04:07 +01:00
Thomas Woerner
e3bf82d873 utils/galaxyfy.py: Support builtins with ansible.builtin. prefix
The ansible builtins are using the ansible.builtin. prefix now, but
galaxyfy was not supporting the prefix. Therefore vars in set_fact tasks
got the collection prefix and include_role tasks have not been handled
correctly.
2023-01-09 17:36:56 +01:00
Thomas Woerner
76ca587d76 Merge pull request #1009 from rjeffman/ci_issue_995
upstream ci: Allow tasks to retry in case of connection failure.
2023-01-05 14:33:29 +01:00
Rafael Guterres Jeffman
5c630d6021 Merge pull request #1003 from dkarpele/dkarpele-2144724
Use netgroup_find instead of netgroup_show to workaround IPA bug.
2023-01-05 09:13:43 -03:00
Denis Karpelevich
483d51b418 Use netgroup_find instead of netgroup_show to workaround IPA bug.
Patch fixes https://bugzilla.redhat.com/show_bug.cgi?id=2144724 which
depends on https://pagure.io/freeipa/issue/9284.
Add comment why replacing `netgroup_show` with `netgroup_find`.

Signed-off-by: Denis Karpelevich <dkarpele@redhat.com>
2023-01-04 20:30:44 +01:00
Rafael Guterres Jeffman
ba353a9b16 Merge pull request #1007 from t-woerner/FQCN_ansible_builtin
Use FQCN for ansible.builtin
2023-01-03 16:24:19 -03:00
Rafael Guterres Jeffman
56560855b4 upstream ci: Allow tasks to retry in case of connection failure.
Some tasks used to setup Azure environment might fail to temporary
errors like timeouts and connection failures. Allowing the tasks to
retry a few times will allow the test to be correctly executed rather
than returning an error that is not related to the feature tested.
2022-12-26 12:15:06 -03:00
Rafael Guterres Jeffman
a8d44e2c52 Merge pull request #1002 from t-woerner/fix_spec_file_for_loop
ansible-freeipa.spec.in: Fix for loop with wildcard
2022-12-23 18:53:59 -03:00
Thomas Woerner
b175c78c95 vault: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:55:19 +01:00
Thomas Woerner
198298b2d0 user: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:55:03 +01:00
Thomas Woerner
d5269c83e6 trust: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:54:42 +01:00
Thomas Woerner
9d47ffc2b9 sudo*: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:54:26 +01:00
Thomas Woerner
feadbfce95 servicedelegation*: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:54:01 +01:00
Thomas Woerner
a9257e7f44 service: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:53:43 +01:00
Thomas Woerner
d204b6d480 server: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:53:30 +01:00
Thomas Woerner
c645841444 selfservice: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:52:52 +01:00
Thomas Woerner
f2a0edeb25 role: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:52:36 +01:00
Thomas Woerner
45baf5c108 pwpolicy: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:52:21 +01:00
Thomas Woerner
deec31c3ab privilege: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:52:05 +01:00
Thomas Woerner
fea480b348 permission: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:51:51 +01:00
Thomas Woerner
defd1e4e92 netgroup: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:51:21 +01:00
Thomas Woerner
adc262bcb0 location: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:50:58 +01:00
Thomas Woerner
72b4b89116 idrange: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:50:46 +01:00
Thomas Woerner
473ed03e26 host*: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:50:23 +01:00
Thomas Woerner
d546b4614d hbac*: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:49:50 +01:00
Thomas Woerner
872537f4de group: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:49:18 +01:00
Thomas Woerner
d6658347c9 tests/external-signed-ca-*: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:48:37 +01:00
Thomas Woerner
062b53a676 tests/env_freeipa_facts.yml: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:47:21 +01:00
Thomas Woerner
470d0ddc1b dnszone: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:46:54 +01:00
Thomas Woerner
2e707a48cb dnsrecord: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:46:36 +01:00
Thomas Woerner
971d40c3a9 dnsforwardzone: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:46:10 +01:00
Thomas Woerner
7d89af48b6 dnsconfig: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:45:44 +01:00
Thomas Woerner
03ce096fbb delegation: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:45:08 +01:00
Thomas Woerner
91edff3b21 config: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:44:38 +01:00
Thomas Woerner
84c0188023 tests/ca-less: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:43:59 +01:00
Thomas Woerner
1f91730b17 automount: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:41:14 +01:00
Thomas Woerner
99c7acbe5f automember: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:40:09 +01:00
Thomas Woerner
14706cc49e ipabackup role: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:38:30 +01:00
Thomas Woerner
dde5b06b97 ipaclient role: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:37:07 +01:00
Thomas Woerner
c7e83685e3 ipareplica role: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:36:32 +01:00
Thomas Woerner
882d60515d ipaserver role: Use FQCN for ansible.builtin
Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
2022-12-20 13:35:03 +01:00
Thomas Woerner
27cbd40182 ansible-freeipa.spec.in: Fix for loop with wildcard
The issue within the for loops to remove python shebangs and to remove the
execution flag from python files has been solved.
2022-12-06 10:18:08 +01:00
Rafael Guterres Jeffman
c5ba88d725 Merge pull request #1000 from t-woerner/stay_at_ubuntu_20.04
tests/azure: Temporarily stay at Ubuntu 20.04
2022-12-02 13:06:21 -03:00
Thomas Woerner
1a5c62fe9c tests/azure: Temporarily stay at Ubuntu 20.04
Github has been migrating ubuntu-latest from 20.04 to 22.04. 22.04 comes
with cgroups version 2.

No tests are run at the momens as the setup of the test container always
fails with "Failed to create temporary directory" for gathering facts.

See also:

https://github.com/ansible-collections/news-for-maintainers/issues/28
2022-12-02 16:44:22 +01:00
Thomas Woerner
67d6455db6 Merge pull request #992 from rjeffman/test_sanity_ignore_2_14
tests/sanity: Add ignore file for ansible-core 2.14
2022-12-01 13:37:25 +01:00
Rafael Guterres Jeffman
a4b71700f7 tests/sanity: Add ignore file for ansible-core 2.14 2022-11-30 10:13:40 -03:00
Rafael Guterres Jeffman
5f5807b49c Merge pull request #996 from t-woerner/ipaclient_configure_dns_resolver_no_master
ipaclient: No DNS resolver configuration on master
2022-11-30 09:43:45 -03:00
Thomas Woerner
b670d29d30 Merge pull request #991 from rjeffman/remove_deprecated_scripts
utils: Remove deprecated shell scripts used to deploy IPA.
2022-11-30 12:56:15 +01:00
Thomas Woerner
9de235474b Merge pull request #997 from rjeffman/environment_fix_setting_order
environment: Fix os.environ language setting.
2022-11-30 11:01:56 +01:00
Thomas Woerner
a55b4a241a Merge pull request #989 from rjeffman/pre_commit_update
pre-commit: Fix pycqa pre-commit repos.
2022-11-30 09:33:09 +01:00
Thomas Woerner
c68348b5d3 Merge pull request #986 from rjeffman/ci_checkout_depth_0
github worflows: speed up git checkout.
2022-11-30 09:31:42 +01:00
Rafael Guterres Jeffman
76aad71974 environment: Fix os.environ language setting.
A combination of ansible-freeipa modifications and a newer version of
IPA has brought a regression regarding different OS localization.

For properly setting environment to use "C" language, as required by
ansible-freeipa, the setting must be executed before importing the
module 'ipaserver.dcerpc', so setting environment language was moved
closer to the 'import os' statement, so that it is always set, as soon
as possible.

Note that 'import os' should always be imported before any FreeIPA
module.
2022-11-30 00:57:07 -03:00
Thomas Woerner
3b73ad6b27 Merge pull request #971 from rjeffman/pwpolicy_update_params
pwpolicy: Add support for password check and grace limit.
2022-11-29 16:21:49 +01:00
Thomas Woerner
789d6eea14 Merge pull request #922 from rjeffman/sudorule_hostmask
sudorule: Add support for 'hostmask' parameter
2022-11-29 13:08:29 +01:00
Thomas Woerner
422651e6ff ipaclient: No DNS resolver configuration on master
The DNS resolver configuration should not happen in the server client
part installation where ipaclient_on_master is enabled.
2022-11-29 12:58:04 +01:00
Rafael Guterres Jeffman
8459e1c454 utils: Remove deprecated shell scripts used to deploy IPA.
The deprecated shell scripts used to deplay IPA are outdated and are
not needed to deploy IPA. There is no documentation about them, and
they would need to be updated and maintained in the future.
2022-11-28 12:34:09 -03:00
Rafael Guterres Jeffman
0bb0d99aa4 pre-commit: Fix pycqa pre-commit repos.
The pycqa pre-commit repos were using 'gitlab.com', instead of
'github.com', which is, today, the correct repository to use.

This patch fixes the addresses for Flake8 and pydocstyle checks.
2022-11-23 18:36:16 -03:00
Rafael Guterres Jeffman
d859ddc7fe sudorule: Add support for 'hostmask' parameter
The hostmask parameter allows matching a sudorule against a network
address, and was missing from ipasudorule module.

Documentation and tests were updated to reflect changes.

Two new example playbooks are available:

    playbooks/sudorule/ensure-sudorule-hostmask-member-is-absent.yml
    playbooks/sudorule/ensure-sudorule-hostmask-member-is-present.yml
2022-11-23 18:30:48 -03:00
Rafael Guterres Jeffman
460adff1ba Merge pull request #988 from t-woerner/ipaclient_configure_dns_resolver
ipaclient: Configure DNS resolver
2022-11-23 16:24:56 -03:00
Rafael Guterres Jeffman
a823c0b09c Merge pull request #987 from t-woerner/ipaclient_no_kinit_on_controller_for_OTP
ipaclient: No kinit on controller for deployment using OTP
2022-11-23 11:50:57 -03:00
Thomas Woerner
624e0d3435 ipaclient: No kinit on controller for deployment using OTP
The generation of the OTP for client deployment is now completely
happening on the first of the given or detected servers with delegate_to.
The module ipaclient_get_otp has been replaced by a new module using code
from ipahost module and module_utils ansible_freeipa_module.

The action plugin ipaclient_get_otp has been removed and with this also
ipaclient_get_facts.

If an admin keytab is used instead of an admin password, it is copied to
the server as a temporary file to enable the OTP generation. The temporary
file is removed again after using the ipaclient_get_otp module.

The utils script build-galaxy-release.sh has been updated to not copy the
ipaclient action plugin to the global plugins folder of the collection.

This change is import for the use of the ipaclient role with AAP as only
the base environment is sufficient now.

The ipaclient README and also the global README have been updated as
kinit is not needed anymore on the controller for OTP.

Fixes #903 (Allow the use of principals other than admin when using
            ipaadmin_keytab)
2022-11-23 15:20:47 +01:00
Thomas Woerner
1c17f426ac ipaclient: Configure DNS resolver
The configuration of the DNS resolver is useful if the IPA server has
internal DNS support.

The installation of packages is happening before the DNS resolver is
configured, therefore package installation needs to be possible without
the configuration of the DNS resolver.

The DNS nameservers are configured for `NetworkManager`, `systemd-resolved`
(if installed and enabled) and `/etc/resolv.conf` if neither NetworkManager
nor systemd-resolved is used.

Example inventory:

  [ipaserver]
  ipaserver.example.com

  [ipaclients]
  ipaclient1.example.com

  [ipaclients:vars]
  ipaadmin_principal=admin
  ipaadmin_password=MySecretPassword123
  ipaclient_domain=example.com
  ipaclient_configure_dns_resolver=yes
  ipaclient_dns_servers=192.168.100.1
  ipaclient_cleanup_dns_resolver=yes

New parameters:

ipaclient_configure_dns_resolver
  The bool value defines if the DNS resolver is configured. before deploying
  the client. This is useful if the IPA server has internal DNS support.
  ipaclient_dns_server need to be set also.
ipaclient_dns_servers
  The list of DNS server IP addresses. This is only useful with
  ipaclient_configure_dns_resolver.
ipaclient_cleanup_dns_resolver
  The bool value defines if DNS resolvers that have been configured before
  with ipaclient_configure_dns_resolver will be cleaned up again.

New module:

roles/ipaclient/library/ipaclient_configure_dns_resolver.py

Fixes: #902 (Consider adding support for client DNS resolver
             configuration)
2022-11-23 11:40:47 +01:00
Rafael Guterres Jeffman
01287288a7 github worflows: speed up git checkout.
This patch add 'fetch-depth: 0' to 'checkout' plugin on Github Worflows
to slightly speed up verifications.
2022-11-18 12:11:11 -03:00
Rafael Guterres Jeffman
58725364c1 pwpolicy: Add support for password check and grace limit.
On recent versions of FreeIPA option to verify passwords and for
controlling a password grace period have been added to IPA API.

This patch adds support for the parameters maxrepeat, maxsequence,
dictcheck and usercheck, available since FreeIPA, 4.9 and gracelimit,
available since FreeIPA 4.9.10.

Test playbooks for the module have been updated with the new supported
parameters.

New example playbooks can be found at:

    playbooks/pwpolicy/pwpolicy_grace_limit.yml
    playbooks/pwpolicy/pwpolicy_password_check.yml
2022-11-18 11:25:45 -03:00
Rafael Guterres Jeffman
9423eb81b7 Merge pull request #975 from t-woerner/fix_ipareplica_role_for_ansible_test
Fix ipareplica role for ansible test
2022-11-18 11:21:15 -03:00
Rafael Guterres Jeffman
ef11e75944 Merge pull request #968 from t-woerner/fix_ipasmartcard_client_role_for_ansible_test
Fix ipasmartcard client role for ansible test
2022-11-18 11:12:04 -03:00
Rafael Guterres Jeffman
932856df67 Merge pull request #967 from t-woerner/fix_ipabackup_role_for_ansible_test
ipabackup_get_backup_dir: Fix documentation sections and agument spec
2022-11-18 11:11:01 -03:00
Rafael Guterres Jeffman
118d754d69 Merge pull request #969 from t-woerner/fix_ipasmartcard_server_role_for_ansible_test
Fix ipasmartcard server role for ansible test
2022-11-18 11:07:49 -03:00
Rafael Guterres Jeffman
ef5ae121c8 Merge pull request #976 from t-woerner/fix_ipaserver_role_for_ansible_test
Fix ipaserver role for ansible test
2022-11-18 11:05:02 -03:00
Thomas Woerner
9007cffdd9 Merge pull request #984 from rjeffman/tests_shell_warn_removal
upstream tests: Removal of 'warn: no' from shell plugins
2022-11-17 16:18:00 +01:00
Rafael Guterres Jeffman
6601ee3af5 upstream tests: Removal of 'warn: no' from shell plugins
The parameter 'warn' from ansible.builtin.shell was deprecated in
ansible-core version 2.11 and removed in version 2.14.

This patch removes the usage of this parameter from ansible-freeipa
tests, and adds 'deprecated-command-syntax' to the skip list of
ansible-lint configuration to cope with the change in the linter.
2022-11-17 10:35:20 -03:00
Rafael Guterres Jeffman
b34062cabd Merge pull request #972 from t-woerner/fix_ipaclient_role_for_ansible_test
Fix ipaclient role for ansible test
2022-11-17 09:10:39 -03:00
Thomas Woerner
2cfa9af586 Merge pull request #980 from rjeffman/ci_update_checkout
upstream ci: Update Github actions due to old Node.js.
2022-11-14 13:26:46 +01:00
Rafael Guterres Jeffman
f2632d8c90 upstream ci: Use Shellcheck action from 'master'.
The Shellcheck action used in Gtihub workflows has bee updated, but has
not have a new release in 18 months. It is recommended by the action
developers to use the 'master' branch for the action.

This patch enables the use of the master branch for the Shellcheck
action.
2022-11-14 08:59:55 -03:00
Rafael Guterres Jeffman
f82b93a801 upstream ci: Update Github actions due to old Node.js.
There are warnings on Github workflows about the need to update actions
'checkout' and 'setup-python' due to the use of Node.js versions that
are too old.

This patch updates the use of actions/checkout from v2 to v3.1.0, and
setup-python from v2 to v4.3.0.
2022-11-14 08:59:55 -03:00
Thomas Woerner
57c303d816 ipaserver_test: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`
- `choices` needs to match `argument_spec`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_server.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 12:18:02 +01:00
Thomas Woerner
165c3f06b7 ipaserver_setup_otpd: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters

A call to ansible_ipa_server.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 12:18:02 +01:00
Thomas Woerner
300292c050 ipaserver_setup_ntp: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

A call to ansible_ipa_server.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 12:18:02 +01:00
Thomas Woerner
15454c3a48 ipaserver_setup_krb: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

A call to ansible_ipa_server.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 12:18:02 +01:00
Thomas Woerner
d962939a61 ipaserver_setup_kra: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters

A call to ansible_ipa_server.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 12:18:02 +01:00
Thomas Woerner
66dbfce0f7 ipaserver_setup_http: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

A call to ansible_ipa_server.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 12:18:02 +01:00
Thomas Woerner
b22207d6ee ipaserver_setup_ds: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

A call to ansible_ipa_server.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 12:18:02 +01:00
Thomas Woerner
1062e0fe99 ipaserver_setup_dns: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`
- `choices` needs to match `argument_spec`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

A call to ansible_ipa_server.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 12:18:02 +01:00
Thomas Woerner
1148476cf5 ipaserver_setup_custodia: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters

A call to ansible_ipa_server.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 12:18:02 +01:00
Thomas Woerner
9eb07f7024 ipaserver_setup_ca: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

A call to ansible_ipa_server.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 12:18:02 +01:00
Thomas Woerner
0faf8c86ca ipaserver_setup_adtrust: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters

A call to ansible_ipa_server.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 12:18:02 +01:00
Thomas Woerner
9f3a2d42d0 ipaserver_set_ds_password: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

A call to ansible_ipa_server.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 12:18:02 +01:00
Thomas Woerner
c2475304ec ipaserver_prepare: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_server.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 12:18:02 +01:00
Thomas Woerner
2a817a989d ipaserver_master_password: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

RETURN section

- `type: str` needs to be used for string parameters

argument_spec

- `type='str'` needs to be set for string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_server.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 12:18:02 +01:00
Thomas Woerner
03e9dd3f00 ipaserver_load_cache: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters

A call to ansible_ipa_server.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 12:18:02 +01:00
Thomas Woerner
62d49e4e9e ipaserver_enable_ipa: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters

A call to ansible_ipa_server.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 12:18:02 +01:00
Thomas Woerner
446107f1cb ansible_ipa_server: Fix ansible-test fake execution test findings
All imports that are only available after installing IPA need to be in a
try exception clause to be able to pass the fake execution test. The old
workaround "if 'ansible.executor' in sys.modules:" is not working with
this test anymore.

If the imports can not be done, all used and needed attributes are
defines with the value None.

The new function check_imports has been added to fail with module.fail_json
if an import exception occured and ANSIBLE_IPA_SERVER_MODULE_IMPORT_ERROR is
not None. This function needs to be called in all modules.

The `copyright` date is extended with `-2022`.
2022-11-14 12:17:59 +01:00
Thomas Woerner
7627c57c4a ipareplica_test: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
4cfa28eea7 ipareplica_setup_otpd: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
e42f1c118b ipareplica_setup_krb: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
78e94864b0 ipareplica_setup_kra: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`
- all parameters need to be defined

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
ea3142ba44 ipareplica_setup_http: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
b3f85d49df ipareplica_setup_ds: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
12ee8a9201 ipareplica_setup_dns: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
72d9fea37a ipareplica_setup_custodia: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
99289fc33e ipareplica_setup_certmonger: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `suboptions` needs to be removed without arguments
- `author` needs to be given with the github user also: `Name (@user)`

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
d12c3748a7 ipareplica_setup_ca: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
8906cfc81b ipareplica_setup_adtrust: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
3f91a53b2e ipareplica_restart_kdc: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
d1e518385e ipareplica_promote_sssd: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
b4aa4a2af8 ipareplica_promote_openldap_conf: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
732133a460 ipareplica_prepare: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`
- `choices` needs to match `argument_spec`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
4a342685af ipareplica_master_password: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
1a80954475 ipareplica_krb_enable_ssl: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
55393307b8 ipareplica_install_ca_certs: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `module` tag needs to be correct
- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
88645e5c4a ipareplica_enable_ipa: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
ae4aaf51f0 ipareplica_ds_enable_ssl: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
32f681dba2 ipareplica_ds_apply_updates: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
bd04171a56 ipareplica_custodia_import_dm_password: Fix doc sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
065db1b359 ipareplica_create_ipa_conf: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
8c81ac0f5f ipareplica_add_to_ipaservers: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_replica.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
d4c34a28df ansible_ipa_replica: Fix ansible-test fake execution test findings
All imports that are only available after installing IPA need to be in a
try exception clause to be able to pass the fake execution test. The old
workaround "if 'ansible.executor' in sys.modules:" is not working with
this test anymore.

If the imports can not be done, all used and needed attributes are
defines with the value None.

The new function check_imports has been added to fail with module.fail_json
if an import exception occured and ANSIBLE_IPA_REPLICA_MODULE_IMPORT_ERROR is
not None. This function needs to be called in all modules.

The `copyright` date is extended with `-2022`.
2022-11-14 09:27:51 +01:00
Thomas Woerner
f1d2d63f2b ipaclient_test_keytab: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

RETURN section

- `type: str` needs to be used for string parameters

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_client.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:25:16 +01:00
Thomas Woerner
b89dd0d036 ipaclient_test: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

RETURN section

- `elements: str` needs to be given for list of string parameters
- `type: string` is not valid and needs to be replaced by `type: str`
- `returned` needs to be set

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_client.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:25:16 +01:00
Thomas Woerner
aa43583149 ipaclient_setup_sssd: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `module` tag needs to be correct
- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_client.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:25:16 +01:00
Thomas Woerner
e152259757 ipaclient_setup_ssh: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_client.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:25:16 +01:00
Thomas Woerner
a65b24c172 ipaclient_setup_ntp: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_client.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:25:16 +01:00
Thomas Woerner
a1667babf4 ipaclient_setup_nss: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_client.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:25:16 +01:00
Thomas Woerner
08ffa7c466 ipaclient_setup_nis: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_client.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:25:16 +01:00
Thomas Woerner
0f724598a8 ipaclient_setup_krb5: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_client.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:25:16 +01:00
Thomas Woerner
1239109e43 ipaclient_setup_firefox: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_client.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:25:16 +01:00
Thomas Woerner
4baeaa1e68 ipaclient_setup_automount: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_client.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:25:16 +01:00
Thomas Woerner
923cd9f5b1 ipaclient_set_hostname: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_client.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:25:16 +01:00
Thomas Woerner
c3f48d2851 ipaclient_join: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

supports_check_mode is turned off as it is not supported.

A call to ansible_ipa_client.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:25:16 +01:00
Thomas Woerner
3c413cfdfd ipaclient_ipa_conf: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters
- `elements='dict'` needs to be added to all list of dict parameters

A call to ansible_ipa_client.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:25:16 +01:00
Thomas Woerner
e932f65b7c ipaclient_get_otp: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`
- `choices` needs to match `argument_spec`

RETURN section

- `type: string` is not valid and needs to be replaced by `type: str`
- `elements: str` needs to be given for list of string parameters

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters

A call to ansible_ipa_client.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:25:16 +01:00
Thomas Woerner
c633b2dc88 ipaclient_get_facts: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

A copyright header needs to be present.

DOCUMENTATION section

- `author` needs to be given with the github user also: `Name (@user)`

Example section needs to be present, even if empty.

RETURN section needs to be present if parameters are returned.
2022-11-14 09:25:16 +01:00
Thomas Woerner
c37be7416c ipaclient_fstore: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters

A call to ansible_ipa_client.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:25:16 +01:00
Thomas Woerner
97a7232bdc ipaclient_fix_ca: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `type` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type='str'` needs to be set for string parameters
- `elements='str'` needs to be added to all list of string parameters
- `elements='dict'` needs to be added to all list of dict parameters

A call to ansible_ipa_client.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:25:16 +01:00
Thomas Woerner
e3ba5c75cb ipaclient_api: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

RETURN section

- `type: string` is not valid and needs to be replaced by `type: str`

argument_spec

- `elements='str'` needs to be added to all list of string parameters
- `elements='dict'` needs to be added to all list of dict parameters

A call to ansible_ipa_client.check_imports has been added to check for import
errors.

The `copyright` date is extended with `-2022`.
2022-11-14 09:25:16 +01:00
Thomas Woerner
b2dfd11058 ansible_ipa_client: Fix ansible-test fake execution test findings
All imports that are only available after installing IPA need to be in a
try exception clause to be able to pass the fake execution test. The old
workaround "if 'ansible.executor' in sys.modules:" is not working with
this test anymore.

If the imports can not be done, all used and needed attributes are
defines with the value None.

The new function check_imports has been added to fail with module.fail_json
if an import exception occured and ANSIBLE_IPA_CLIENT_MODULE_IMPORT_ERROR is
not None. This function needs to be called in all modules.

The `copyright` date is extended with `-2022`.
2022-11-14 09:25:16 +01:00
Thomas Woerner
0f0c098fa2 Merge pull request #978 from rjeffman/ci_update_linters
linters: Fix versions of linter packages due to Python 3.11.
2022-11-14 09:23:46 +01:00
Rafael Guterres Jeffman
29dccf3d8a pylint: Fix pylint issues on utils/galaxyfy-module-EXAMPLES.py 2022-11-11 15:59:42 -03:00
Rafael Guterres Jeffman
9b6fd8cce0 pylint: Update configuration for Python 3.11
Update pylint configuration on setup.cfg to cope with recent changes
in Python 3.11.
2022-11-11 15:59:42 -03:00
Rafael Guterres Jeffman
10b3f4610c pylint: Modify certificate loader function definition.
This patch modifies the way that the certificate load function is
defined, depending on the dependency version, so that the resulting
identifier for the function is always set and static analysis tools,
like linters don't complain about variables being used before being
set.

The same idiom is applied to both the ipaclient role and the plugins
ansible_module_utils.
2022-11-11 15:59:42 -03:00
Rafael Guterres Jeffman
b7e39ce7e9 linters: Fix versions of linter packages due to Python 3.11.
Under Python 3.11 some linters have failed to execute due to deprecated
items. Increasing or setting specific allow the linters to succeed with
Python's lates version.
2022-11-11 15:59:42 -03:00
Thomas Woerner
07b9c7dc40 Merge pull request #981 from rjeffman/netgroup_fix_test_cleanup
netgroup: Fix environment cleanup on ipanetgroup tests.
2022-11-11 18:09:44 +01:00
Rafael Guterres Jeffman
3773e300f0 netgroup: Fix environment cleanup on ipanetgroup tests.
Tests for ipanetgroup were not correctly clearing up the tests, causing
test failures when running them in some specific order.

By fixing the 'name' attribute list the tests succeed, independently of
the order they are executed.
2022-11-11 13:21:48 -03:00
Thomas Woerner
68c52b564a Merge pull request #875 from dkarpele/dkarpele-cert-show
New netgroup management module
2022-11-11 13:26:35 +01:00
Rafael Guterres Jeffman
5a07782cbe Merge pull request #979 from t-woerner/fix_ipaclient_setup_nss_undefined_ca_certs
ipaclient_setup_nss: Fix undefined ca_certs for NoCertificateError case
2022-11-11 08:39:36 -03:00
Thomas Woerner
1ba397e783 ipaclient_setup_nss: Fix undefined ca_certs for NoCertificateError case
In case get_certs_from_ldap failed with errors.NoCertificateError the
code lead to a trace back as certstore.make_compat_ca_certs was using
with undefined ca_certs variable.

The code to generate ca_certs for this case was copied over from
ipaclient_api. This is loading the certificate list from paths.IPA_CA_CRT.
2022-11-10 16:13:00 +01:00
Rafael Guterres Jeffman
767b4d36a6 Merge pull request #973 from t-woerner/fix-upstream-ansible-test-ansible-2.13
Fix upstream ansible test ansible 2.13
2022-11-07 13:38:19 -03:00
Thomas Woerner
2e6041d0a7 tests/sanity/sanity.sh: shellcheck: Fix command for use_docker
use_docker was determined using `which docker`, shellcheck wants to have
`docker -v` instead.
2022-11-07 17:20:02 +01:00
Thomas Woerner
a4c890ab3b tests/sanity: New tests/sanity/ignore-2.13.txt for ansible-test
Copy of tests/sanity/ignore-2.13.txt with removed compile-2.6 and import-2.6
lines.
2022-11-07 17:16:56 +01:00
Thomas Woerner
903e002e85 ipasmartcard_server_validate_ca_certs: Fix doc sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `elements="str"` needs to be added to all list of string parameters
2022-10-28 19:24:16 +02:00
Thomas Woerner
0dc49d0706 ipasmartcard_server_get_vars: Fix doc sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `suboptions` needs to be removed without arguments
- `author` needs to be given with the github user also: `Name (@user)`
2022-10-28 19:23:38 +02:00
Thomas Woerner
18008d3ff2 ipasmartcard_client_validate_ca_certs: Fix doc sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `module` needs to match module name
- `type: list` needs to be set for list parameters
- `required` tags need to be fixed according to the `argument_spec`

argument_spec

- `elements="str"` needs to be added to all list of string parameters
2022-10-28 19:20:50 +02:00
Thomas Woerner
aba9add595 ipasmartcard_client_get_vars: Fix doc sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `suboptions` needs to be removed without arguments
- `author` needs to be given with the github user also: `Name (@user)`
2022-10-28 19:20:36 +02:00
Thomas Woerner
4353ad72e4 ipabackup_get_backup_dir: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `suboptions` needs to be removed without arguments
- `author` needs to be given with the github user also: `Name (@user)`

The `copyright` date is extended with `-2022`.
2022-10-28 19:07:51 +02:00
Rafael Guterres Jeffman
4ad3c84cae Merge pull request #932 from t-woerner/fix_dnsrecord_docs_for_ansible_test
ipadnsrecord: Fix documentation sections and agument spec
2022-10-26 20:36:46 -03:00
Rafael Guterres Jeffman
7e92fec884 Merge pull request #966 from t-woerner/fix_ipamodule_base_docs_for_ansible_test
ipamodule_base_docs: Fix documentation sections
2022-10-26 20:35:48 -03:00
Thomas Woerner
1a8df6e955 ipamodule_base_docs: Fix documentation sections
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
2022-10-26 23:21:50 +02:00
Thomas Woerner
77c6770bfc ipadnsrecord: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `type: string` is not valid and needs to be replaced by `type: str`
- `suboptions` instead of `options` needs to be used for dict parameters
- `authors` needs to be given with the github user also: `Name (@user)`
- `choices` needs to match `argument_spec`
- `description` needs to match parameter
- all parameters need to be defined

argument_spec

- `elements="str"` needs to be added to all list of string parameters
- `no_log=False` or `no_log=True` needs to be set for all parameters
  that have `key` in the name or for dicts also in one the key names
- `elements="dict"` needs to be added to all list of dict parameters

The `copyright` date is extended with `-2022`.
2022-10-26 22:37:21 +02:00
Rafael Guterres Jeffman
169e772f29 Merge pull request #938 from t-woerner/fix_host_docs_for_ansible_test
ipahost: Fix documentation sections and agument spec
2022-10-26 14:47:43 -03:00
Thomas Woerner
44e2718aa1 ipahost: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `suboptions` instead of `options` needs to be used for dict parameters
- `required` tags need to be fixed according to the `argument_spec`
- `aliases` tag needs to match `argument_spec`
- `type` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

RETURN section

- `contains` needs to be used instead of `options` for dicts
- `type: str` needs to be used for string parameters

argument_spec

- `elements="str"` needs to be added to all list of string parameters
- `no_log=False` or `no_log=True` needs to be set for all parameters
  that have `key` in the name or for dicts also in one the key names

The `copyright` date is extended with `-2022`.

Additional changes:

- Parameter sshpubkey changed to list of strings in argument_spec
- New test test/host/test_host_sshpubkey.yml
2022-10-26 17:32:34 +02:00
Rafael Guterres Jeffman
c1827807c6 Merge pull request #957 from t-woerner/fix_user_docs_for_ansible_test
ipauser: Fix documentation sections and agument spec
2022-10-26 08:42:00 -03:00
Rafael Guterres Jeffman
5c1c4d83c2 Merge pull request #958 from t-woerner/fix_vault_docs_for_ansible_test
ipavault: Fix documentation sections and agument spec
2022-10-26 08:41:50 -03:00
Rafael Guterres Jeffman
38e874fddb Merge pull request #931 from t-woerner/fix_dnsforwardzone_docs_for_ansible_test
ipadnsforwardzone: : Fix documentation sections and agument spec
2022-10-21 15:30:53 -03:00
Denis Karpelevich
495677df38 New netgroup management module
There is a new netgroup management module placed in the plugins folder:

    plugins/modules/ipanetgroup.py

The netgroup module allows to ensure presence or absence of netgroup
and manage netgroup members.

Here is the documentation for the module:

    README-netgroup.md

New example playbooks have been added:

    playbooks/netgroup/netgroup-absent.yml
    playbooks/netgroup/netgroup-member-absent.yml
    playbooks/netgroup/netgroup-member-present.yml
    playbooks/netgroup/netgroup-present.yml

New tests for the module:

    tests/netgroup/test_netgroup.yml
    tests/netgroup/test_netgroup_client_context.yml
    tests/netgroup/test_netgroup_member.yml
    tests/netgroup/test_netgroup_member_absent.yml
    tests/netgroup/test_netgroup_member_case_insensitive.yml

Signed-off-by: Denis Karpelevich <dkarpele@redhat.com>
2022-10-19 21:38:39 +02:00
Rafael Guterres Jeffman
6e44b4d034 Merge pull request #954 from t-woerner/fix_ipatopologysegment_docs_for_ansible_test
ipatopologysegment: Fix documentation sections and agument spec
2022-10-19 11:06:56 -03:00
Thomas Woerner
9c71d91a2e ipatopologysegment: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type="str"` needs to added to all string parameters

The `copyright` date is extended with `-2022`.
2022-10-19 15:56:39 +02:00
Thomas Woerner
9271b84df8 README-vault: Add new_public_key and new_public_key_file
According to the argument_spec new_public_key is an alias for
vault_public_key and new_public_key_file is an alias for
vault_public_key_file. The aliases have been added.
2022-10-19 15:45:28 +02:00
Thomas Woerner
2621b311f9 ipavault: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: bool` needs to be set for bool parameters

- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `type: string` is not valid and needs to be replaced by `type: str`
- `required` tags need to be fixed according to the `argument_spec`
- `aliases` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`
- `choices` needs to match `argument_spec`
- all parameters need to be defined

RETURN section

- `contains` needs to be used instead of `options` for dicts
- `type: string` is not valid and needs to be replaced by `type: str`

argument_spec

- `elements="str"` needs to be added to all list of string parameters
- `default=.*` needs to be dropped if `required=True` is also given

The `copyright` date is extended with `-2022`.
2022-10-19 15:43:28 +02:00
Thomas Woerner
9480841b12 Merge pull request #959 from rjeffman/remove_whitelist
documentation: Change occurences of whitelist to allowlist.
2022-10-19 15:41:48 +02:00
Thomas Woerner
461a9ec092 Merge pull request #960 from rjeffman/ansbile_2_14_new_module
new_module: Modify new_module and templates for Ansible 2.14
2022-10-19 15:40:07 +02:00
Rafael Guterres Jeffman
706eb15291 documentation: Change occurences of whitelist to allowlist.
This change follows language use recomendation from NISTIR 8366,
"Guidance for NIST Staff on Using Inclusive Language in Documentary
Standards", accessible from

    https://nvlpubs.nist.gov/nistpubs/ir/2021/NIST.IR.8366.pdf
2022-10-18 21:13:20 -03:00
Thomas Woerner
f8ca8a7b87 Merge pull request #961 from rjeffman/ipaconfig_fix_enable_sid_not_required
ipaconfig: Do not require enable_sid for add_sids or netbios_name
2022-10-18 16:28:19 +02:00
Rafael Guterres Jeffman
c808ad6e34 ipaconfig: Do not require enable_sid for add_sids or netbios_name
Current behavior of ipaconfig mimics FreeIPA CLI and requires that
'enable_sid' is set to True every time add_sids or netbios_name are
used. It is sufficient that SID generation is enabled to use add_sids
and netbios_name, but the IPA API requires 'enable_sid' so that the
operations are executed.

This patch allows ansible-freeipa plugin ipaconfig to run 'add_sids' or
set 'netbios_name without requiring 'enable_sid' to be set on the
playbook.

If SID generation is enabled, 'add_sids' and 'netbios_name' can be used
without 'enable_sid: yes'. If SID generation is not enabled, an error
message will be raised if 'enable_sid: yes' is not used.
2022-10-18 11:13:43 -03:00
Thomas Woerner
17606651eb Merge pull request #921 from rjeffman/ipaconfig_fix_enablesid_false
ipaconfig: Do not allow enable_sid set to False.
2022-10-17 18:16:58 +02:00
Rafael Guterres Jeffman
320168071f ipaconfig: Do not allow enable_sid set to False.
Once enabled, SID cannot be disabled. This patch ensures that an error
is raised if one tries to disable SID.
2022-10-17 12:26:57 -03:00
Thomas Woerner
aa4cc3bf45 Merge pull request #920 from rjeffman/ipaconfig_fix_fail_json
ipaconfig: Fix fail_json calls.
2022-10-13 11:07:36 +02:00
Rafael Guterres Jeffman
fa86cd2944 Merge pull request #948 from t-woerner/fix_service_docs_for_ansible_test
ipaservice:: Fix documentation sections and agument spec
2022-10-08 17:20:57 -03:00
Rafael Guterres Jeffman
49dbf9fd6c Merge pull request #947 from t-woerner/fix_server_docs_for_ansible_test
ipaserver: Fix documentation sections and agument spec
2022-10-08 17:17:44 -03:00
Rafael Guterres Jeffman
f194e919a0 Merge pull request #945 from t-woerner/fix_role_docs_for_ansible_test
iparole: Fix documentation sections and agument spec
2022-10-08 17:10:14 -03:00
Rafael Guterres Jeffman
69a2be7b51 Merge pull request #946 from t-woerner/fix_selfservice_docs_for_ansible_test
ipaselfservice: Fix documentation sections and agument spec
2022-10-08 17:06:39 -03:00
Rafael Guterres Jeffman
684dfd9cf3 Merge pull request #943 from t-woerner/fix_privilege_docs_for_ansible_test
ipaprivilege: Fix documentation sections and agument spec
2022-10-08 17:05:26 -03:00
Rafael Guterres Jeffman
aebb4456ab Merge pull request #942 from t-woerner/fix_permission_docs_for_ansible_test
ipapermission: Fix documentation sections and agument spec
2022-10-08 16:57:26 -03:00
Rafael Guterres Jeffman
3877fb689f Merge pull request #940 from t-woerner/fix_idrange_docs_for_ansible_test
ipaidrange: Fix documentation sections and agument spec
2022-10-06 08:57:51 -03:00
Rafael Guterres Jeffman
9a8d756ad6 new_module: Modify new_module and templates for Ansible 2.14
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete.

To aid the creation of new_modules that follow these rules, the
'new_module' script and its templates were modified to use the new
ansible-test rules. The 'new_module' script now requires a new
argument, github_user, and the code templates provide the required
fields (like 'type' and 'elements') to the provide examples.
2022-10-05 08:46:53 -03:00
Rafael Guterres Jeffman
1bf7fb7233 Merge pull request #944 from t-woerner/fix_pwpolicy_docs_for_ansible_test
ipapwpolicy: Fix documentation sections and agument spec
2022-10-04 15:21:08 -03:00
Rafael Guterres Jeffman
5382c625b2 Merge pull request #949 from t-woerner/fix_servicedelegationrule_docs_for_ansible_test
ipaservicedelegationrule: Fix documentation sections and agument spec
2022-10-04 15:19:58 -03:00
Rafael Guterres Jeffman
61277c0898 Merge pull request #950 from t-woerner/fix_servicedelegationtarget_docs_for_ansible_test
ipaservicedelegationtarget: Fix documentation sections and agument spec
2022-10-04 15:16:52 -03:00
Rafael Guterres Jeffman
cd36d32fea Merge pull request #951 from t-woerner/fix_ipasudocmd_docs_for_ansible_test
ipasudocmd: Fix documentation sections and agument spec
2022-10-04 15:15:05 -03:00
Rafael Guterres Jeffman
0411b12bbb Merge pull request #955 from t-woerner/fix_ipatopologysuffix_docs_for_ansible_test
ipatopologysuffix: Fix documentation sections and agument spec
2022-10-04 15:10:12 -03:00
Rafael Guterres Jeffman
b2ea0d79be Merge pull request #952 from t-woerner/fix_ipasudocmdgroup_docs_for_ansible_test
ipasudocmdgroup: Fix documentation sections and agument spec
2022-10-04 15:08:44 -03:00
Rafael Guterres Jeffman
b7c0954553 Merge pull request #956 from t-woerner/fix_ipatrust_docs_for_ansible_test
ipatrust Fix documentation sections and agument spec
2022-10-04 15:07:29 -03:00
Rafael Guterres Jeffman
87d0812396 Merge pull request #939 from t-woerner/fix_hostgroup_docs_for_ansible_test
ipahostgroup: Fix documentation sections and agument spec
2022-10-04 14:58:43 -03:00
Rafael Guterres Jeffman
49ad4cbfe1 Merge pull request #937 from t-woerner/fix_hbacsvcgroup_docs_for_ansible_test
ipahbacsvcgroup: Fix documentation sections and agument spec
2022-10-03 16:51:33 -03:00
Rafael Guterres Jeffman
2f8911eba5 Merge pull request #936 from t-woerner/fix_hbacsvc_docs_for_ansible_test
ipahbacsvc: Fix documentation sections and agument spec
2022-10-03 16:50:13 -03:00
Rafael Guterres Jeffman
031b6f2f16 Merge pull request #941 from t-woerner/fix_location_docs_for_ansible_test
ipalocation: Fix documentation sections and agument spec
2022-09-30 23:43:22 -03:00
Rafael Guterres Jeffman
35210b3646 Merge pull request #935 from t-woerner/fix_hbacrule_docs_for_ansible_test
ipahbacrule: Fix documentation sections and agument spec
2022-09-30 23:42:10 -03:00
Rafael Guterres Jeffman
d1ce1526d2 Merge pull request #934 from t-woerner/fix_group_docs_for_ansible_test
ipagroup: Fix documentation sections and agument spec
2022-09-30 23:33:46 -03:00
Rafael Guterres Jeffman
0161fea4df Merge pull request #930 from t-woerner/fix_dnsconfig_docs_for_ansible_test
ipadnsconfig: Fix documentation sections and agument spec
2022-09-30 23:26:48 -03:00
Rafael Guterres Jeffman
757c0a142b Merge pull request #933 from t-woerner/fix_dnszone_docs_for_ansible_test
ipadnszone: Fix documentation sections and agument spec
2022-09-30 23:25:07 -03:00
Rafael Guterres Jeffman
f4fcf1b578 Merge pull request #929 from t-woerner/fix_delegation_docs_for_ansible_test
ipadelegation: : Fix documentation sections and agument spec
2022-09-30 22:34:46 -03:00
Rafael Guterres Jeffman
4da89de1d4 ipaconfig: Fix fail_json calls.
Ansible's fail_json() method required that the message paramater was
passed with a keyword parameter, rather than a positional one. Although
this seems to work with ansible-core 2.13+, it might not work with
previous versions of Ansible.

This patch fixes the behaviour for all supported Ansible versions.
2022-09-30 15:29:21 -03:00
Rafael Guterres Jeffman
0ad7635332 Merge pull request #953 from t-woerner/fix_ipasudorule_docs_for_ansible_test
ipasudorule: Fix documentation sections and agument spec
2022-09-30 15:10:27 -03:00
Rafael Guterres Jeffman
0ba404733d Merge pull request #928 from t-woerner/fix_config_docs_for_ansible_test
ipaconfig: Fix documentation sections and agument spec
2022-09-30 15:07:20 -03:00
Rafael Guterres Jeffman
3c1c3ebe55 Merge pull request #927 from t-woerner/fix_automountmap_docs_for_ansible_test
ipaautomountmap: Fix documentation sections and agument spec
2022-09-30 15:05:07 -03:00
Rafael Guterres Jeffman
95d961ccf6 Merge pull request #925 from t-woerner/fix_automountkey_docs_for_ansible_test
ipaautomountkey: Fix documentation sections and agument spec
2022-09-30 15:02:10 -03:00
Rafael Guterres Jeffman
1c1d26c404 Merge pull request #926 from t-woerner/fix_automountlocation_docs_for_ansible_test
ipaautomountlocation: Fix documentation sections and agument spec
2022-09-30 14:37:14 -03:00
Rafael Guterres Jeffman
43e548a25d Merge pull request #924 from t-woerner/fix_automember_docs_for_ansible_test
ipaautomember: Fix documentation sections and agument spec
2022-09-30 14:03:54 -03:00
Thomas Woerner
58c936a189 ipauser: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `elements: dict` needs to be given for list of dict parameters
- `aliases` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

RETURN section

- `contains` needs to be used instead of `options` for dicts
- `type: str` needs to be used for string parameters

argument_spec

- `elements="str"` needs to be added to all list of string parameters
- `no_log=False` or `no_log=True` needs to be set for all parameters
  that have `password` in the name

The `copyright` date is extended with `-2022`.

Note:
The alias "login" was used for "users" instead of "users"->"name".
"login" is an alias for "name" if "users" is not used.
2022-09-30 18:23:35 +02:00
Thomas Woerner
af87a2d923 ipatrust Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: int` needs to be set for integer parameters
- `type: bool` needs to be set for bool parameters
- `required` tags need to be fixed according to the `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`
- `choices` needs to match `argument_spec`

argument_spec

- `default=.*` needs to be dropped if `required=True` is also given

The `copyright` date is extended with `-2022`.
2022-09-30 18:20:16 +02:00
Thomas Woerner
87aae5b396 ipatopologysuffix: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `type="str"` needs to added to all string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 18:18:37 +02:00
Thomas Woerner
97a0aa8d1a ipasudorule: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `aliases` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 18:13:42 +02:00
Thomas Woerner
3850c6a0e0 ipasudocmdgroup: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 18:11:06 +02:00
Thomas Woerner
d4d714dcf4 ipasudocmd: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 18:09:22 +02:00
Thomas Woerner
9cb4a51592 ipaservicedelegationtarget: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 18:07:07 +02:00
Thomas Woerner
f64663519e ipaservicedelegationrule: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 18:05:43 +02:00
Thomas Woerner
ca036d424a ipaservice:: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `aliases` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`
- all parameters need to be defined

argument_spec

- `elements="str"` needs to be added to all list of string parameters
- `no_log=False` or `no_log=True` needs to be set for all parameters
  that have `key` in the name or for dicts also in one the key names

The `copyright` date is extended with `-2022`.
2022-09-30 17:58:39 +02:00
Thomas Woerner
40dc47ec72 ipaserver: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 17:56:33 +02:00
Thomas Woerner
8f2e96cb2c ipaselfservice: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 17:54:23 +02:00
Thomas Woerner
d2d04615b4 iparole: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- all parameters need to be defined
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 17:51:35 +02:00
Thomas Woerner
4ac5d820fc ipapwpolicy: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `author` needs to be given with the github user also: `Name (@user)`
- `extends_documentation_fragment: ipamodule_base_docs` needs added and
  `ipaadmin_*` parameters need to be removed

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 17:49:02 +02:00
Thomas Woerner
57bedd84a3 ipaprivilege: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 17:45:31 +02:00
Thomas Woerner
bf2eb2200d ipapermission: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `aliases` tag needs to match `argument_spec`
- `choices` needs to match `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 17:41:04 +02:00
Thomas Woerner
65732f33c1 ipalocation: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 15:41:16 +02:00
Thomas Woerner
bb31fbd67e ipaidrange: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `type: string` is not valid and needs to be replaced by `type: str`
- `required` tags need to be fixed according to the `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 15:37:51 +02:00
Thomas Woerner
187d7e73ab ipahostgroup: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 15:35:18 +02:00
Thomas Woerner
9920c7604c ipahbacsvcgroup: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 15:25:48 +02:00
Thomas Woerner
5e935eb85b ipahbacsvc: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `author` needs to be given with the github user also: `Name (@user)`

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 15:22:03 +02:00
Thomas Woerner
c8ca316474 ipahbacrule: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `authors` needs to be given with the github user also: `Name (@user)`

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 15:19:57 +02:00
Thomas Woerner
93c134b68b ipagroup: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: int` needs to be set for integer parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `aliases` tag needs to match `argument_spec`
- `authors` needs to be given with the github user also: `Name (@user)`

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 15:01:41 +02:00
Thomas Woerner
19758959e4 ipadnszone: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `suboptions` instead of `options` needs to be used for dict parameters
- `aliases` tag needs to match `argument_spec`
- `type` tag needs to match `argument_spec`
- `required` tags need to be fixed according to the `argument_spec`
- `authors` needs to be given with the github user also: `Name (@user)`

RETURN section

- `type: dict` needs to be given for dicts
- `contains` needs to be used instead of `options` for dicts
- `type: str` needs to be used for string parameters

argument_spec

- `elements="str"` needs to be added to all list of string parameters
- `elements="dict"` needs to be added to all list of dict parameters
- `type=str` and `type=int` need to be replaced by `type="str"` and
  `type="int"`

The `copyright` date is extended with `-2022`.
2022-09-30 14:52:37 +02:00
Thomas Woerner
0fa28ba1fa ipadnsforwardzone: : Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `module` tag needs to be correct
- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `suboptions` instead of `options` needs to be used for dict parameters
- `aliases` tag needs to match `argument_spec`
- `default` tag needs to match `argument_spec`
- `authors` needs to be given with the github user also: `Name (@user)`
- `action` parameter is missing and added

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 14:40:16 +02:00
Thomas Woerner
44e19ada63 ipadnsconfig: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: int` needs to be set for integer parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `aliases` tag need to be consistent to `argument_spec`
- `authors` needs to be given with the github user also: `Name (@user)`

argument_spec

- `elements="str"` needs to be added to all list of string parameters
- `type=str` and `type=int` need to be replaced by `type="str"` and
  `type="int"`

The `copyright` date is extended with `-2022`.
2022-09-30 14:39:45 +02:00
Thomas Woerner
daa007c0d5 ipadelegation: : Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `authors` needs to be given with the github user also: `Name (@user)`

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 14:27:51 +02:00
Thomas Woerner
9836f83589 ipaconfig: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `module` tag needs to be correct
- `type: str` needs to be set for string parameters
- `type: int` needs to be set for integer parameters
- `type: list` needs to be set for list parameters
- `type: string` is not valid and needs to be replaced by `type: str`
- `elements: str` needs to be given for list of string parameters
- `authors` needs to be given with the github user also: `Name (@user)`

RETURN section

- `contains` needs to be used instead of `options` for dicts
- `type: str` needs to be set for string parameters
- `type: int` needs to be set for integer parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `description` needs to be correct

argument_spec

- `elements="str"` needs to be added to all list of string parameters

The `copyright` date is extended with `-2022`.
2022-09-30 14:27:16 +02:00
Thomas Woerner
3f9acecaf3 ipaautomountmap: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `aliases` tag need to be consistent to `argument_spec`
- `extends_documentation_fragment: ipamodule_base_docs` needs added and
  `ipaadmin_*` parameters need to be removed

argument_spec

- `elements="str"` needs to be added to all list of string parameters
- `default=.*` needs to be dropped if `required=True` is also given

The `copyright` date is extended with `-2022`.
2022-09-30 14:26:42 +02:00
Thomas Woerner
e7e6572e02 ipaautomountlocation: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `type: list` needs to be set for list parameters
- `elements: str` needs to be given for list of string parameters
- `authors` needs to be given with the github user also: `Name (@user)`

argument_spec

- `elements="str"` needs to be added to all list of string parameters
- `default=.*` needs to be dropped if `required=True` is also given

The `copyright` date is extended with `-2022`.
2022-09-30 14:25:57 +02:00
Thomas Woerner
489eb5780f ipaautomountkey: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section
- `type: str` needs to be set for string parameters
- `required` tags need to be fixed according to the `argument_spec`
- `aliases` tag need to be consistent to `argument_spec`
- `authors` needs to be given with the github user also: `Name (@user)`
- `extends_documentation_fragment: ipamodule_base_docs` needs added and
  `ipaadmin_*` parameters need to be removed
- `choices` needs to be replaced with `aliases` to match `argument_spec`

argument_spec
- `no_log=False` or `no_log=True` needs to be set for all parameters
  that have `key` in the name or for dicts also in one the key names
- `required=None` needs to be replaced by `required=False`

The `copyright` date is extended with `-2022`.
2022-09-30 14:25:18 +02:00
Thomas Woerner
5978033427 ipaautomember: Fix documentation sections and agument spec
ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete. Needed
changes:

DOCUMENTATION section

- `type: str` needs to be set for string parameters
- `elements: str` needs to be given for list of string parameters
- `suboptions` instead of `options` needs to be used for dict parameters
- `authors` needs to be given with the github user also: `Name (@user)`
- `required` tag was fixed according to the argument_spec

arguemnt_spec

- `elements="str"` needs to be added to all list of string parameters
- `no_log=False` or `no_log=True` needs to be set for all parameters
  that have `key` in the name or for dicts also in one the key names.

The `copyright` date is extended with `-2022`.
2022-09-30 14:24:13 +02:00
Rafael Guterres Jeffman
07c8bb1efb Merge pull request #918 from t-woerner/fix_plugins_for_ansible_fake_execution_test
Fix plugins for ansible fake execution test
2022-09-27 10:56:42 -03:00
Rafael Guterres Jeffman
f03ad35563 Merge pull request #917 from t-woerner/fix_ipabackup_for_ansible_fake_execution_test
ipabackup_get_backup_dir: Fix for ansible-test fake execution test
2022-09-27 10:56:23 -03:00
Rafael Guterres Jeffman
e62089ed70 Merge pull request #916 from t-woerner/fix_ipasmartcard_client_for_ansible_fake_execution_test
ipasmartcard_client_get_vars: Fix for ansible-test fake execution test
2022-09-27 10:56:10 -03:00
Rafael Guterres Jeffman
973319b44c Merge pull request #915 from t-woerner/fix_ipasmartcard_server_for_ansible_fake_execution_test
ipasmartcard_server_get_vars: Fix for ansible-test fake execution test
2022-09-27 10:55:42 -03:00
Thomas Woerner
83117a204b tests/sanity/ignore-2.12.txt: Remove unnecessary entries
ERROR: Found 2 pylint issue(s) which need to be resolved:

ERROR: tests/sanity/ignore-2.12.txt:3:1: ansible-test: Ignoring
'ansible-bad-import-from' on
'plugins/module_utils/ansible_freeipa_module.py' is unnecessary

ERROR: tests/sanity/ignore-2.12.txt:5:1: ansible-test: Ignoring
'ansible-format-automatic-specification' on
'plugins/module_utils/ansible_freeipa_module.py' is unnecessary
2022-09-27 12:58:36 +02:00
Thomas Woerner
75d481c6ff ipadnszone: import netaddr and DNSName from ansible_freeipa_module
ansible_freeipa_module is providing netaddr and also DNSName, therefore
it is not needed to have own imports in the module. These own imports
would need an addional try exception clause to be able to pass the
ansible-test fake execution test.
2022-09-27 12:55:06 +02:00
Thomas Woerner
fe364cc2db ipadnsrecord: Fix for ansible-test fake execution test
All imports that are only available after installing IPA need to be in a
try exception clause to be able to pass the fake execution test.

If the imports can not be done, all used and needed attributes are
defined with the value None, MODULE_IMPORT_ERROR is set to the import
error and fail_json is called.
2022-09-27 12:54:11 +02:00
Thomas Woerner
71f3f11031 ansible_freeipa_module: Fix ansible-test fake execution test findings
All imports that are only available after installing IPA need to be in a
try exception clause to be able to pass the fake execution test. The old
workaround "if 'ansible.executor' in sys.modules:" is not working with
this test anymore.

If the imports can not be done, all used and needed attributes are
defines with the value None.

A check has been added to IPAAnsibleModule.__init__ to make sure that it
fails if the imports have not been done successfully.
2022-09-27 12:53:15 +02:00
Thomas Woerner
5865d41dc4 ipabackup_get_backup_dir: Fix for ansible-test fake execution test
All imports that are only available after installing IPA need to be in a
try exception clause to be able to pass the fake execution test.

If the imports can not be done, all used and needed attributes are
defined with the value None, MODULE_IMPORT_ERROR is set to the import
error and fail_json is called.
2022-09-27 12:47:21 +02:00
Thomas Woerner
98ba88214f ipasmartcard_client_get_vars: Fix for ansible-test fake execution test
All imports that are only available after installing IPA need to be in a
try exception clause to be able to pass the fake execution test.

If the imports can not be done, all used and needed attributes are
defined with the value None, MODULE_IMPORT_ERROR is set to the import
error and fail_json is called.
2022-09-27 12:45:58 +02:00
Thomas Woerner
5a2675e375 ipasmartcard_server_get_vars: Fix for ansible-test fake execution test
All imports that are only available after installing IPA need to be in a
try exception clause to be able to pass the fake execution test.

If the imports can not be done, all used and needed attributes are
defined with the value None, MODULE_IMPORT_ERROR is set to the import
error and fail_json is called.
2022-09-27 12:44:40 +02:00
Rafael Guterres Jeffman
3c6e15aa37 Merge pull request #914 from rjeffman/reenable_dnsforwardzone_tests
Re-enable dnsforwardzone tests
2022-09-26 19:38:47 -03:00
Rafael Guterres Jeffman
f2d698b8d2 Merge pull request #913 from t-woerner/remove_deprecated_FreeIPABaseModule
ansible_freeipa_module: Remove deprecated FreeIPABaseModule
2022-09-16 16:01:58 -03:00
Rafael Guterres Jeffman
8d90c74b28 Azure CI: Re-enable dnszone tests with forwarder ports
As the latest versions of FreeIPA contain fixes to set the port on
DNS forwarders, this patch re-enables the upstream tests.
2022-09-16 14:56:02 -03:00
Rafael Guterres Jeffman
70030fd3e5 Azure CI: Update variable files instructions.
Update instuctions on Azure template varible files to reflect the
current test configuration behavior.
2022-09-16 14:39:03 -03:00
Thomas Woerner
fb0b19ed01 tests/sanity/ignore-2.12.txt: Remove ansible-deprecated-no-collection-name
ansible-deprecated-no-collection-name is not needed anymore for
plugins/module_utils/ansible_freeipa_module.py with the removal of
FreeIPABaseModule class.
2022-09-16 18:35:47 +02:00
Thomas Woerner
64ee210c91 ansible_freeipa_module: Remove deprecated FreeIPABaseModule
The FreeIPABaseModule class has been maked deprecated with
ansible-freeipa version 1.5.0. It is not used in the code any more
therefore it is time to finally remove it.
2022-09-16 18:10:24 +02:00
Rafael Guterres Jeffman
433d1096f8 Merge pull request #911 from t-woerner/update_spec_file
utils/ansible-freeipa.spec.in: Sync with Fedora rawhide spec file
2022-09-09 14:46:30 -03:00
Thomas Woerner
6a2d007b41 Merge pull request #912 from rjeffman/ipaconfig_fix_playbook_titles
ipaconfig: Fix example playbook titles.
2022-09-09 19:41:19 +02:00
Thomas Woerner
b0f58ef3a8 Merge pull request #906 from rjeffman/ipaconfig_sid
ipaconfig: Add support for SID related attributes.
2022-09-09 19:38:08 +02:00
Rafael Guterres Jeffman
3c8d6c7c7a ipaconfig: Add support for SID related attributes.
Since FreeIPA 4.9.8 the 'config_mod' command has parameters to enable
and configure SIDs, and set the Netbios name.

This patch adds the following parameters to ipaconfig plugin:
    enable_sids: New users and groups automatically get a SID assigned
    add_sids: Add SIDs for existing users and groups
    netbios_name: NetBIOS name of the IPA domain

Both add_sids and netbios_name requires 'enable_sid: yes'.

'enable_sid' and 'netbios_name' are returned when querying IPA
configuration.

'add_sids' always generate SIDs for users and groups, so, muiltiple
executions of the playbook with 'add_sids: yes' will return 'changed',
even if users and groups SIDs are not modified.

A new test playbook is available:

    tests/config/test_config_sid.yml

New examples playbooks are available:

    playbooks/config/change-ipa-domain-netbios-name.yml
    playbooks/config/generate-users-groups-sids.yml

Fixes: #781
Related: https://bugzilla.redhat.com/show_bug.cgi?id=2069174
Related: https://bugzilla.redhat.com/show_bug.cgi?id=2069184
2022-09-09 11:40:05 -03:00
Rafael Guterres Jeffman
3b28050f1e ipaconfig: Fix example playbook titles. 2022-09-09 11:24:59 -03:00
Thomas Woerner
2973c80975 Merge pull request #904 from rjeffman/ipabackup_fix_parameter_eval_order
ipabackup: Fix order of ipabackup_name parameter evaluation.
2022-09-08 16:32:06 +02:00
Thomas Woerner
0f8f55dfd9 Merge pull request #910 from rjeffman/fix_fast_pr_tests
upstream CI: Force retrieval of ansible-freeipa master.
2022-09-08 16:30:28 +02:00
Rafael Guterres Jeffman
777f25d91c upstream CI: Force retrieval of ansible-freeipa master.
This patch forces the addition of a remote repository pointing to the
main ansible-freeipa repo, and fetch its contents before confaring the
modified files. The remote repository is removed after the modified
file list is generated.
2022-09-08 08:51:56 -03:00
Rafael Guterres Jeffman
727861cb85 upstream CI: Force retrieval of ansible-freeipa master.
This patch forces the addition of a remote repository pointing to the
main ansible-freeipa repo, and fetch its contents before confaring the
modified files. The remote repository is removed after the modified
file list is generated.
2022-09-08 08:50:56 -03:00
Rafael Guterres Jeffman
e6da214bfb ipabackup: Fix order of ipabackup_name parameter evaluation.
When performing a backup with 'state:present', if 'ipabackup_name' is
provided, the backup will be performed, but the role with return an
error since 'ipabackup_name' should not be set for this state.

This patch moves the parameter evaluation to be performed before the
actual backup is performed, so that the backup is not performed and an
error is reported.
2022-09-08 08:50:56 -03:00
Thomas Woerner
68a99ba5f9 utils/ansible-freeipa.spec.in: Sync with Fedora rawhide spec file
The spec file was updated and was lacking several updates.
2022-09-08 13:42:30 +02:00
Thomas Woerner
d936a3794e Merge pull request #901 from rjeffman/tests_ipabackup
ipabackup: Add playbook tests for ipabackup.
2022-09-07 14:26:53 +02:00
Thomas Woerner
bb0ba1ef2c Merge pull request #908 from rjeffman/ci_fix_module_comparison
upstream CI: Ensure 'master' branch is available for set_test_modules
2022-09-06 21:25:51 +02:00
Rafael Guterres Jeffman
1eb83548fa upstream CI: Ensure 'master' branch is available for set_test_modules
If the repository is setup in a way that master branch is not available
for comparing the current HEAD against it, the comparison will fail and
not module/role will be scheduled for testing.

This patch forces fetching 'master' from ansible-freeipa repository,
allowing the comparison to be performed.
2022-09-06 15:47:01 -03:00
Thomas Woerner
5d7afb5f85 Merge pull request #893 from rjeffman/ci_tests_fast_run
upstream CI: run PR tests only for affected plugins
2022-09-06 19:28:41 +02:00
Rafael Guterres Jeffman
f7c45c4f46 ipabackup: Add playbook tests for ipabackup.
A new test playbook for ipabackup role can be found at:

    tests/role_backup/test_backup.yml

The test is not yet complete, as 'state: restored' is not tested.
2022-09-06 09:35:21 -03:00
Rafael Guterres Jeffman
38a4bf804f Merge pull request #905 from t-woerner/ipaserver_ipareplica_module_log_isatty
ipaserver/ipareplica: Add isatty method to AnsibleModuleLog
2022-09-05 17:24:28 -03:00
Thomas Woerner
7077776de3 ipaserver/ipareplica: Add isatty method to AnsibleModuleLog
In some cases ipa code is using sys.stdout.isatty. As stdout is mapped
to AnsibleModuleLog this call will lead in a traceback as it was not
defined.

The staticmethod isatty has been added to AnsibleModuleLog in ipaserver
role module_utils/ansible_ipa_server.py and in ipareplica role
module_utils/ansible_ipa_repica.py.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2120415
       ansible-freeipa Replica Install Setup DNS fails
Fixes: #251 - 'AnsibleModuleLog' object has no attribute 'isatty'
Fixes: #117 - 'AnsibleModuleLog' object has no attribute 'isatty'
2022-09-05 13:23:02 +02:00
Rafael Guterres Jeffman
2514158498 upstream CI: run PR tests only for affected plugins
The current workflow for bug fixing or new enhancements in
ansible-freeipa includes running Ansible playbooks tests for all the
available plugins for every pull request, even for contained
modifications.

This patch creates a new workflow for pull requests where only the
affected plugins are tested in the PR. Changes that might affect other
parts of the code will trigger tests for the parts affected.

A utility script, utils/filter_tests, is used to set the variables
IPA_ENABLED_MODULES and IPA_ENABLED_TESTS before executing the tests,
effectively limiting which tests are executed. The script uses the
python plugin 'utils/filter_plugins.py' which lists all test modules
that should be executed for a list of modified source files.

Tests are selected for execution based on the plugin name. For example,
a change to 'plugins/modules/ipalocation.py' would trigger all playbook
tests under 'tests/location'. If a test playbook is modified, it is
scheduled to be executed. Changes to any file under
'plugins/module_utils' will force the execution of all tests, since any
module might be affected by that change.

The nature of the change is not evaluated, so a simple typo fix of a
comment in a file under 'plugins/module_utils' would still schedule all
test playbooks to be executed.

For roles, any file changed under the role directory would set the role
to be included in the tests. Playbook tests for roles must be created
under 'tests/<rolename>_role', where role name in the name of the role
without 'ipa', for example, the 'ipabackup' role test playbooks would
be stored under 'tests/backup_role'.

Since there is the possibility that the list of tests to be executed
might be less than the number of tests groups used (3), a new pytest
dependency was added, pytest-custom_exit_code, so that having no tests
to run isn't a test failure.

A new pipeline on Azure needs to be created to use the new test script.
2022-09-02 19:06:46 -03:00
Rafael Guterres Jeffman
c6cc4df77b check_test_configuration: Add support for IPA_* environment variables
This patch adds support for IPA_ENABLED_* and IPA_DISABLED_* environment
variables as existing global configuration for the tests.
2022-08-31 15:06:43 -03:00
Rafael Guterres Jeffman
b3ee4f9bed tests: Drop pytest-split-tests in favor of pytest-split
The plugin pytest-split-tests is used to split the tests in several
groups so that the tests can be executed in parallel is upstream CI.

The issue is thet pytest-split-tests last release was more that a
year ago, upstream developers have not been responsive, and there is
a bug when the number of tests to be executed by a group is zero.
The patch to fix this issue has been open for a year.

This patch deprecates the use of pytest-split-tests, changing the
plugin used to split the tests to pytest-split, which is actively
mainatined.
2022-08-31 15:06:43 -03:00
Thomas Woerner
401d5d5acc Merge pull request #849 from rjeffman/dev_run_tests_locally
Run tests locally with upstream CI images.
2022-08-31 15:40:00 +02:00
Rafael Guterres Jeffman
b971c6c5eb Merge pull request #897 from t-woerner/add_ipaserver_idstart_check
ipaserver: Add missing idstart check
2022-08-31 10:01:03 -03:00
Thomas Woerner
de8911af50 ipaserver: Add missing idstart check
The idstart needs to be larger than UID_MAX or GID_MAX from /etc/login.defs.
This is "Require idstart to be larger than UID_MAX" for freeipa.

Fixes: #896 (Invalid RID/SID SSSD backtrace after deployment)
2022-08-30 16:38:42 +02:00
Rafael Guterres Jeffman
7e6e6c2dc2 run-tests: Run tests locally with upstream CI images
This patch allows local execution of playbook tests using ustream CI
testing images. Either 'podman' or 'docker' can be used to execute the
tests.
2022-08-29 18:13:30 -03:00
Rafael Guterres Jeffman
668d89cdb2 Merge pull request #894 from t-woerner/ipaserver_no_ipaclient_package_install
ipaserver: ipaclient part does not need to install packages
2022-08-29 17:50:06 -03:00
Rafael Guterres Jeffman
0c1d4efc03 Merge pull request #895 from t-woerner/temporarily_disable_some_dns_tests_in_fedora_rawhide
fedora rawhide: Temporarily disable failing DNS tests
2022-08-29 17:35:50 -03:00
Thomas Woerner
eefe91b852 Merge pull request #890 from rjeffman/fix_disable_test_split
upstream CI: Fix list evaluation in IPA_ENABLED/IPA_DISABLED tests
2022-08-29 15:35:17 +02:00
Thomas Woerner
bed8bf6661 fedora rawhide: Temporarily disable failing DNS tests
Some DNS tests have been disabled for Fedora latest, but not for Fedora
Rawhide. Therefore these tests are filin still in nighty:

- dnsforwardzone
- test_dnsconfig_forwarders_ports
2022-08-29 14:59:56 +02:00
Thomas Woerner
577aeea3f3 ipaserver: ipaclient part does not need to install packages
The client part installation is checking for the client packages. These
packages are part of the server packages that have been installed with
the server role and therefore the task is not needed.

This is helping to reduce the deployment time of a server.
2022-08-29 10:10:20 +02:00
Rafael Guterres Jeffman
4775ad9a53 Merge pull request #892 from t-woerner/fix_short_description_tag
Fix short_description flag in plugins, role modules and templates
2022-08-26 15:26:57 -03:00
Thomas Woerner
81143be96a Fix short_description flag in plugins, role modules and templates
Before "short description" was used in most plugins, modules and also
in the new module templates.

ansible-doc was therefore not showing the short description. To fix the
issue the flag was renamed to short_description instead.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2121362
       'ansible-doc' -l lists most idm modules as 'UNDOCUMENTED'
2022-08-26 15:27:00 +02:00
Rafael Guterres Jeffman
7debaa23ac upstream CI: Fix list evaluation in IPA_ENABLED/IPA_DISABLED tests
When enabling or disabling multiple tests, a comma separated list must
be used, but current code is using a colon to split the list.

This patch fixes this behavior.
2022-08-25 13:06:10 -03:00
Rafael Guterres Jeffman
e05dc41e0f Merge pull request #876 from t-woerner/ipareplica_do_not_overwrite_ipaclient_no_ntp_for_client_part_deployment
ipareplica: Do not overwrite ipaclient_no_ntp for client part deployment
2022-08-25 09:30:42 -03:00
Thomas Woerner
8bab7d365b Merge pull request #889 from rjeffman/doc_user_required_fields
ipauser: Add note on attributes 'first' and 'last' requirements
2022-08-25 14:08:19 +02:00
Thomas Woerner
018337a19b Merge pull request #884 from rjeffman/ci_enable_distro_selection
upstream CI: enable/disable tests based on test image
2022-08-25 10:08:05 +02:00
Rafael Guterres Jeffman
bb08884221 ipauser: Add note on attributes 'first' and 'last' requirements
Attributes 'first' and 'last' are required if user does not exist, but
current documentation doesn't make it clear. This patch adds a note on
both attributes to make clear the cases where the attribute is required
2022-08-24 23:23:51 -03:00
Rafael Guterres Jeffman
abef329b8a upstream ci: Add step to display scenario configuration
Since test configuration can vary in different scenarios (test images)
this patch adds a script to list the scenarios configuration, and a
step to the playbook test jobs to display the scenario configuration.
2022-08-24 16:52:38 -03:00
Rafael Guterres Jeffman
3216f8df37 upstream ci: Avoid scheduling tests that will not be executed.
Currently, all tests are scheduled to execution, even those that are
not executed due to being absent from the list of enabled tests
configured in the IPA_ENABLED_* variables. The tests that are not
executed are marked 'skipped'.

This patch change this behavior by not scheduling tests that are not
configured to be executed. It means that tests not the IPA_DISABLED_*
lists are not skipped anymore, but not scheduled to be executed. If
any test is in IPA_ENABLED_* lists, only those tests are marked for
execution. A side effect is that there is no visual feedback on which
tests were not executed, as disabled tests are not evaluated anymore.

Also, when IPA_SERVER_HOST was not set, all tests were skipped, but
an error should raised in this case, as there are no hosts to run the
tests against.

This patch modifies this behavior to fail the test with an exception if
IPA_SERVER_HOST is not set.
2022-08-24 16:22:39 -03:00
Rafael Guterres Jeffman
edccf70bf6 upstream ci: Add support for distro specific test configuration.
Sometimes, mostly due do differences in package versions, there are
some tests that fail on a single distribution which cannot be fixed
by ansible-freeipa, requiring that the offending package is fixed.

To keep tests running succesfully we have options to disable the
failing tests, but this changes are globally applied, meaning that, by
disabling a test, it is disable in all tested distributions.

This patch allows tests to be enabled or disabled for a specific
distribution, by setting the configuration on the 'variable' template
for the specific testing scenario.
2022-08-24 16:22:39 -03:00
Thomas Woerner
fd79f95f9b Merge pull request #887 from rjeffman/doc_fix_ipasudorule
ipasudorule: Fix usage of 'action' and 'state' in examples.
2022-08-24 10:15:52 +02:00
Rafael Guterres Jeffman
e2fcd7767e ipasudorule: Fix usage of 'action' and 'state' in examples.
Some examples in ipasudorule were using `action: enabled` when it
should've been `state: enabled`. The examples were fixed.
2022-08-23 12:31:54 -03:00
Thomas Woerner
5a14f78d44 ipareplica: Do not overwrite ipaclient_no_ntp for client part deployment
The NTP server chrony was always enabled and set up due to overwriting
the parameter ipaclient_no_ntp for the client part deployment.

For IPA deployments up to 4.6 no_ntp was always used for the client
part deployment in ipa-replica-install. But afterwards ntp was
configured in the replica deployment part if no_ntp was not set.

The ipareplica roles always relied on the client for setting up the NTP
server but overwrote the setting for the client deployment part. This
did not result in a failure to enable the chrony server in RHEL and Fedora
based distributions as NTP server was always required by the ipa-server
package.

Fixes: #871 (ipa-replica-install with no-ntp is ignored)
2022-08-18 15:55:02 +02:00
Varun Mylaraiah
a3a7ecd817 Merge pull request #880 from t-woerner/flake8_ipavault_fix
ipavault: Fix missing whitespace after keyword issue
2022-08-16 17:34:32 +05:30
Varun Mylaraiah
63f016226c Merge pull request #877 from t-woerner/ipareplica_fix_ipaNTFlatName_update_issue
ipareplica: ipareplica_setup_adtrust fails while updating ipaNTFlatName
2022-08-16 17:31:40 +05:30
Thomas Woerner
a58f61792b ipavault: Fix missing whitespace after keyword issue
flake8 reports an issue in ipavault:

  plugins/modules/ipavault.py:528:20: E275 missing whitespace after keyword

The missing whitespace has been added: "and not(" -> "and not ("
2022-08-16 10:18:03 +02:00
Thomas Woerner
641c550cc3 ipareplica: ipareplica_setup_adtrust fails while updating ipaNTFlatName
The internal parameter sid_generation_always is generated in
ipareplica_test to enable SID generation if ipareplica_setup_adtrust is
not enabled.

This parameter was not used for ipareplica_prepare though, therefore
adtrust.install_check was not executed and did not set the attribute
adtrust.netbios_name. As a result adtrust.netbios_name was None and the
try to use this as the new NetBIOS domain name failed with an
INVALID_SYNTAX error in adtrustinstance while executing
ipareplica_setup_adtrust.

This issue only occurs if SIDs are not enabled in the domain yet for
example with an old deployment.
2022-08-15 16:17:57 +02:00
424 changed files with 17575 additions and 8006 deletions

View File

@@ -10,10 +10,17 @@ exclude_paths:
- molecule/
- tests/azure/
- meta/runtime.yml
- requirements-docker.yml
- requirements-podman.yml
kinds:
- playbook: '**/tests/**/test_*.yml'
- playbook: '**/playbooks/**/*.yml'
- playbook: '**/tests/ca-less/install_*_without_ca.yml'
- playbook: '**/tests/ca-less/clean_up_certificates.yml'
- playbook: '**/tests/external-signed-ca-with-automatic-copy/install-server-with-external-ca-with-automatic-copy.yml'
- playbook: '**/tests/external-signed-ca-with-manual-copy/install-server-with-external-ca-with-manual-copy.yml'
- playbook: '**/tests/user/create_users_json.yml'
- tasks: '**/tasks_*.yml'
- tasks: '**/env_*.yml'
@@ -26,6 +33,9 @@ skip_list:
- '305' # Use shell only when shell functionality is required
- '306' # risky-shell-pipe
- yaml # yamllint should be executed separately.
- experimental # Do not run any experimental tests
- name[template] # Allow Jinja templating inside task names
- var-naming
use_default_rules: true

View File

@@ -8,7 +8,7 @@ jobs:
name: Verify ansible-test sanity
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- name: Install virtualenv using pip

View File

@@ -4,42 +4,14 @@ on:
- push
- pull_request
jobs:
check_docs_29:
name: Check Ansible Documentation with Ansible 2.9.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install Ansible 2.9
run: |
python -m pip install "ansible < 2.10"
- name: Run ansible-doc-test
run: |
ANSIBLE_LIBRARY="." ANSIBLE_DOC_FRAGMENT_PLUGINS="." python utils/ansible-doc-test -v roles plugins
check_docs_2_11:
name: Check Ansible Documentation with ansible-core 2.11.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install Ansible 2.11
run: |
python -m pip install "ansible-core >=2.11,<2.12"
- name: Run ansible-doc-test
run: |
ANSIBLE_LIBRARY="." ANSIBLE_DOC_FRAGMENT_PLUGINS="." python utils/ansible-doc-test -v roles plugins
check_docs_2_12:
check_docs_oldest_supported:
name: Check Ansible Documentation with ansible-core 2.12.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- uses: actions/setup-python@v4.3.0
with:
python-version: '3.x'
- name: Install Ansible 2.12
@@ -47,15 +19,50 @@ jobs:
python -m pip install "ansible-core >=2.12,<2.13"
- name: Run ansible-doc-test
run: |
python -m pip install "ansible-core >=2.12,<2.13"
ANSIBLE_LIBRARY="." ANSIBLE_DOC_FRAGMENT_PLUGINS="." python utils/ansible-doc-test -v roles plugins
check_docs_latest:
check_docs_previous:
name: Check Ansible Documentation with ansible-core 2.13.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- uses: actions/setup-python@v4.3.0
with:
python-version: '3.x'
- name: Install Ansible 2.13
run: |
python -m pip install "ansible-core >=2.13,<2.14"
- name: Run ansible-doc-test
run: |
ANSIBLE_LIBRARY="." ANSIBLE_DOC_FRAGMENT_PLUGINS="." python utils/ansible-doc-test -v roles plugins
check_docs_current:
name: Check Ansible Documentation with ansible-core 2.14.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- uses: actions/setup-python@v4.3.0
with:
python-version: '3.x'
- name: Install Ansible 2.14
run: |
python -m pip install "ansible-core >=2.14,<2.15"
- name: Run ansible-doc-test
run: |
ANSIBLE_LIBRARY="." ANSIBLE_DOC_FRAGMENT_PLUGINS="." python utils/ansible-doc-test -v roles plugins
check_docs_ansible_latest:
name: Check Ansible Documentation with latest Ansible version.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- uses: actions/setup-python@v4.3.0
with:
python-version: '3.x'
- name: Install Ansible-latest

View File

@@ -8,36 +8,40 @@ jobs:
name: Verify ansible-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- uses: actions/setup-python@v4.3.0
with:
python-version: "3.x"
- name: Run ansible-lint
run: |
pip install ansible-core==2.11.6 ansible-lint
find playbooks roles tests -name '*.yml' ! -name "env_*" ! -name "tasks_*" -exec ansible-lint --force-color {} \+
env:
ANSIBLE_MODULE_UTILS: plugins/module_utils
ANSIBLE_LIBRARY: plugins/modules
ANSIBLE_DOC_FRAGMENT_PLUGINS: plugins/doc_fragments
pip install "ansible-core >=2.14,<2.15" ansible-lint
utils/build-galaxy-release.sh -ki
cd .galaxy-build
ansible-lint
yamllint:
name: Verify yamllint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- uses: actions/setup-python@v4.3.0
with:
python-version: "3.x"
- name: Run yaml-lint
uses: ibiqlik/action-yamllint@v1
uses: ibiqlik/action-yamllint@v3.1.1
pydocstyle:
name: Verify pydocstyle
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- uses: actions/setup-python@v4.3.0
with:
python-version: "3.x"
- name: Run pydocstyle
@@ -49,32 +53,38 @@ jobs:
name: Verify flake8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- uses: actions/setup-python@v4.3.0
with:
python-version: "3.x"
- name: Run flake8
run: |
pip install flake8
pip install flake8 flake8-bugbear
flake8
pylint:
name: Verify pylint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- uses: actions/setup-python@v4.3.0
with:
python-version: "3.x"
- name: Run pylint
run: |
pip install pylint==2.12.2
pip install pylint==2.14.4 wrapt==1.14.0
pylint plugins roles --disable=import-error
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@1.1.0
uses: ludeeus/action-shellcheck@master

View File

@@ -8,7 +8,9 @@ jobs:
name: Verify readme
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- name: Run readme test
run: |
error=0

6
.gitignore vendored
View File

@@ -1,5 +1,11 @@
*.pyc
*.retry
*.swp
# collection files
freeipa-ansible_freeipa*.tar.gz
redhat-rhel_idm*.tar.gz
importer_result.json
# ignore virtual environments
/.tox/

View File

@@ -1,7 +1,7 @@
---
repos:
- repo: https://github.com/ansible/ansible-lint.git
rev: v5.3.2
rev: v6.6.1
hooks:
- id: ansible-lint
always_run: false
@@ -11,20 +11,20 @@ repos:
entry: |
env ANSIBLE_LIBRARY=./plugins/modules ANSIBLE_MODULE_UTILS=./plugins/module_utils ANSIBLE_DOC_FRAGMENT_PLUGINS=./plugins/doc_fragments ansible-lint
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.26.1
rev: v1.28.0
hooks:
- id: yamllint
files: \.(yaml|yml)$
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
- repo: https://github.com/pycqa/flake8
rev: 5.0.3
hooks:
- id: flake8
- repo: https://gitlab.com/pycqa/pydocstyle
rev: 6.1.1
- repo: https://github.com/pycqa/pydocstyle
rev: 6.0.0
hooks:
- id: pydocstyle
- repo: https://github.com/pycqa/pylint
rev: v2.12.2
rev: v2.14.4
hooks:
- id: pylint
args:

175
README-cert.md Normal file
View File

@@ -0,0 +1,175 @@
Cert module
============
Description
-----------
The cert module makes it possible to request, revoke and retrieve SSL certificates for hosts, services and users.
Features
--------
* Certificate request
* Certificate hold/release
* Certificate revocation
* Certificate retrieval
Supported FreeIPA Versions
--------------------------
FreeIPA versions 4.4.0 and up are supported by the ipacert module.
Requirements
------------
**Controller**
* Ansible version: 2.8+
* Some tool to generate a certificate signing request (CSR) might be needed, like `openssl`.
**Node**
* Supported FreeIPA version (see above)
Usage
=====
Example inventory file
```ini
[ipaserver]
ipaserver.test.local
```
Example playbook to request a new certificate for a service:
```yaml
---
- name: Certificate request
hosts: ipaserver
tasks:
- name: Request a certificate for a web server
ipacert:
ipaadmin_password: SomeADMINpassword
state: requested
csr: |
-----BEGIN CERTIFICATE REQUEST-----
MIGYMEwCAQAwGTEXMBUGA1UEAwwOZnJlZWlwYSBydWxlcyEwKjAFBgMrZXADIQBs
HlqIr4b/XNK+K8QLJKIzfvuNK0buBhLz3LAzY7QDEqAAMAUGAytlcANBAF4oSCbA
5aIPukCidnZJdr491G4LBE+URecYXsPknwYb+V+ONnf5ycZHyaFv+jkUBFGFeDgU
SYaXm/gF8cDYjQI=
-----END CERTIFICATE REQUEST-----
principal: HTTP/www.example.com
register: cert
```
Example playbook to revoke an existing certificate:
```yaml
---
- name: Revoke certificate
hosts: ipaserver
tasks:
- name Revoke a certificate
ipacert:
ipaadmin_password: SomeADMINpassword
serial_number: 123456789
state: revoked
```
Example to hold a certificate (alias for revoking a certificate with reason `certificateHold (6)`):
```yaml
---
- name: Hold a certificate
hosts: ipaserver
tasks:
- name: Hold certificate
ipacert:
ipaadmin_password: SomeADMINpassword
serial_number: 0xAB1234
state: held
```
Example playbook to release hold of certificate (may be used with any revoked certificates, despite of the rovoke reason):
```yaml
---
- name: Release hold
hosts: ipaserver
tasks:
- name: Take a revoked certificate off hold
ipacert:
ipaadmin_password: SomeADMINpassword
serial_number: 0xAB1234
state: released
```
Example playbook to retrieve a certificate and save it to a file in the target node:
```yaml
---
- name: Retriev certificate
hosts: ipaserver
tasks:
- name: Retrieve a certificate and save it to file 'cert.pem'
ipacert:
ipaadmin_password: SomeADMINpassword
certificate_out: cert.pem
state: retrieved
```
ipacert
-------
Variable | Description | Required
-------- | ----------- | --------
`ipaadmin_principal` | The admin principal is a string and defaults to `admin` | no
`ipaadmin_password` | The admin password is a string and is required if there is no admin ticket available on the node | no
`ipaapi_context` | The context in which the module will execute. Executing in a server context is preferred. If not provided context will be determined by the execution environment. Valid values are `server` and `client`. | no
`ipaapi_ldap_cache` | Use LDAP cache for IPA connection. The bool setting defaults to yes. (bool) | no
`csr` | X509 certificate signing request, in PEM format. | yes, if `state: requested`
`principal` | Host/service/user principal for the certificate. | yes, if `state: requested`
`add` \| `add_principal` | Automatically add the principal if it doesn't exist (service principals only). (bool) | no
`profile_id` \| `profile` | Certificate Profile to use | no
`ca` | Name of the issuing certificate authority. | no
`chain` | Include certificate chain in output. (bool) | no
`serial_number` | Certificate serial number. (int) | yes, if `state` is `retrieved`, `held`, `released` or `revoked`.
`revocation_reason` \| `reason` | Reason for revoking the certificate. Use one of the reason strings, or the corresponding value: "unspecified" (0), "keyCompromise" (1), "cACompromise" (2), "affiliationChanged" (3), "superseded" (4), "cessationOfOperation" (5), "certificateHold" (6), "removeFromCRL" (8), "privilegeWithdrawn" (9), "aACompromise" (10) | yes, if `state: revoked`
`certificate_out` | Write certificate (chain if `chain` is set) to this file, on the target node. | no
`state` | The state to ensure. It can be one of `requested`, `held`, `released`, `revoked`, or `retrieved`. `held` is the same as revoke with reason "certificateHold" (6). `released` is the same as `cert-revoke-hold` on IPA CLI, releasing the hold status of a certificate. | yes
Return Values
=============
Values are returned only if `state` is `requested` or `retrieved` and if `certificate_out` is not defined.
Variable | Description | Returned When
-------- | ----------- | -------------
`certificate` | Certificate fields and data. (dict) <br>Options: | if `state` is `requested` or `retrieved` and if `certificate_out` is not defined
&nbsp; | `certificate` - Issued X509 certificate in PEM encoding. Will include certificate chain if `chain: true`. (list) | always
&nbsp; | `san_dnsname` - X509 Subject Alternative Name. | When DNSNames are present in the Subject Alternative Name extension of the issued certificate.
&nbsp; | `issuer` - X509 distinguished name of issuer. | always
&nbsp; | `subject` - X509 distinguished name of certificate subject. | always
&nbsp; | `serial_number` - Serial number of the issued certificate. (int) | always
&nbsp; | `revoked` - Revoked status of the certificate. (bool) | if certificate was revoked
&nbsp; | `owner_user` - The username that owns the certificate. | if `state: retrieved` and certificate is owned by a user
&nbsp; | `owner_host` - The host that owns the certificate. | if `state: retrieved` and certificate is owned by a host
&nbsp; | `owner_service` - The service that owns the certificate. | if `state: retrieved` and certificate is owned by a service
&nbsp; | `valid_not_before` - Time when issued certificate becomes valid, in GeneralizedTime format (YYYYMMDDHHMMSSZ) | always
&nbsp; | `valid_not_after` - Time when issued certificate ceases to be valid, in GeneralizedTime format (YYYYMMDDHHMMSSZ) | always
Authors
=======
Sam Morris
Rafael Jeffman

View File

@@ -65,6 +65,9 @@ Example playbook to read config options:
maxusername: 64
```
Example playbook to set global configuration options:
```yaml
---
- name: Playbook to ensure some config options are set
@@ -79,6 +82,40 @@ Example playbook to read config options:
```
Example playbook to enable SID and generate users and groups SIDs:
```yaml
---
- name: Playbook to ensure SIDs are enabled and users and groups have SIDs
hosts: ipaserver
become: no
gather_facts: no
tasks:
- name: Enable SID and generate users and groups SIDS
ipaconfig:
ipaadmin_password: SomeADMINpassword
enable_sid: yes
add_sids: yes
```
Example playbook to change IPA domain NetBIOS name:
```yaml
---
- name: Playbook to change IPA domain netbios name
hosts: ipaserver
become: no
gather_facts: no
tasks:
- name: Set IPA domain netbios name
ipaconfig:
ipaadmin_password: SomeADMINpassword
enable_sid: yes
netbios_name: IPADOM
```
Variables
=========
@@ -111,6 +148,9 @@ Variable | Description | Required
`user_auth_type` \| `ipauserauthtype` | set default types of supported user authentication (choices: `password`, `radius`, `otp`, `disabled`). Use `""` to clear this variable. | no
`domain_resolution_order` \| `ipadomainresolutionorder` | Set list of domains used for short name qualification | no
`ca_renewal_master_server` \| `ipacarenewalmasterserver`| Renewal master for IPA certificate authority. | no
`enable_sid` | New users and groups automatically get a SID assigned. Cannot be deactivated once activated. Requires IPA 4.9.8+. (bool) | no
`netbios_name` | NetBIOS name of the IPA domain. Requires IPA 4.9.8+ and SID generation to be activated. | no
`add_sids` | Add SIDs for existing users and groups. Requires IPA 4.9.8+ and SID generation to be activated. (bool) | no
Return Values
@@ -140,6 +180,8 @@ Variable | Description | Returned When
&nbsp; | `user_auth_type` | &nbsp;
&nbsp; | `domain_resolution_order` | &nbsp;
&nbsp; | `ca_renewal_master_server` | &nbsp;
&nbsp; | `enable_sid` | &nbsp;
&nbsp; | `netbios_name` | &nbsp;
All returned fields take the same form as their namesake input parameters

View File

@@ -8,6 +8,9 @@ The group module allows to ensure presence and absence of groups and members of
The group module is as compatible as possible to the Ansible upstream `ipa_group` module, but additionally offers to add users to a group and also to remove users from a group.
## Note
Ensuring presence (adding) of several groups with mixed types (`external`, `nonposix` and `posix`) requires a fix in FreeIPA. The module implements a workaround to automatically use `client` context if the fix is not present in the target node FreeIPA and if more than one group is provided to the task using the `groups` parameter. If `ipaapi_context` is forced to be `server`, the module will fail in this case.
Features
--------
@@ -71,6 +74,62 @@ Example playbook to add groups:
name: appops
```
These three `ipagroup` module calls can be combined into one with the `groups` variable:
```yaml
---
- name: Playbook to handle groups
hosts: ipaserver
tasks:
- name: Ensure groups ops, sysops and appops are present
ipagroup:
ipaadmin_password: SomeADMINpassword
groups:
- name: ops
gidnumber: 1234
- name: sysops
user:
- pinky
- name: appops
```
You can also alternatively use a json file containing the groups, here `groups_present.json`:
```json
{
"groups": [
{
"name": "group1",
"description": "description group1"
},
{
"name": "group2",
"description": "description group2"
}
]
}
```
And ensure the presence of the groups with this example playbook:
```yaml
---
- name: Tests
hosts: ipaserver
gather_facts: false
tasks:
- name: Include groups_present.json
include_vars:
file: groups_present.json
- name: Groups present
ipagroup:
ipaadmin_password: SomeADMINpassword
groups: "{{ groups }}"
```
Example playbook to add users to a group:
```yaml
@@ -112,11 +171,11 @@ Example playbook to add group members to a group:
Example playbook to add members from a trusted realm to an external group:
```yaml
--
---
- name: Playbook to handle groups.
hosts: ipaserver
became: true
tasks:
- name: Create an external group and add members from a trust to it.
ipagroup:
ipaadmin_password: SomeADMINpassword
@@ -127,6 +186,24 @@ Example playbook to add members from a trusted realm to an external group:
- WINIPA\\Developers
```
Example playbook to add nonposix and external groups:
```yaml
---
- name: Playbook to add nonposix and external groups
hosts: ipaserver
tasks:
- name: Add nonposix group sysops and external group appops
ipagroup:
ipaadmin_password: SomeADMINpassword
groups:
- name: sysops
nonposix: true
- name: appops
external: true
```
Example playbook to remove groups:
```yaml
@@ -136,13 +213,29 @@ Example playbook to remove groups:
become: true
tasks:
# Remove goups sysops, appops and ops
# Remove groups sysops, appops and ops
- ipagroup:
ipaadmin_password: SomeADMINpassword
name: sysops,appops,ops
state: absent
```
Example playbook to ensure groups are absent:
```yaml
---
- name: Playbook to handle groups
hosts: ipaserver
tasks:
- name: Ensure groups ops and sysops are absent
ipagroup:
ipaadmin_password: SomeADMINpassword
groups:
- name: ops
- name: sysops
state: absent
```
Variables
=========
@@ -152,8 +245,10 @@ Variable | Description | Required
`ipaadmin_principal` | The admin principal is a string and defaults to `admin` | no
`ipaadmin_password` | The admin password is a string and is required if there is no admin ticket available on the node | no
`ipaapi_context` | The context in which the module will execute. Executing in a server context is preferred. If not provided context will be determined by the execution environment. Valid values are `server` and `client`. | no
`ipaapi_ldap_cache` | Use LDAP cache for IPA connection. The bool setting defaults to yes. (bool) | no
`ipaapi_ldap_cache` | Use LDAP cache for IPA connection. The bool setting defaults to <br/>. (bool) | no
`name` \| `cn` | The list of group name strings. | no
`groups` | The list of group dicts. Each `groups` dict entry can contain group variables.<br>There is one required option in the `groups` dict:| no
&nbsp; | `name` - The group name string of the entry. | yes
`description` | The group description string. | no
`gid` \| `gidnumber` | The GID integer. | no
`posix` | Create a non-POSIX group or change a non-POSIX to a posix group. `nonposix`, `posix` and `external` are mutually exclusive. (bool) | no

View File

@@ -372,8 +372,8 @@ There are only return values if one or more random passwords have been generated
Variable | Description | Returned When
-------- | ----------- | -------------
`host` | Host dict with random password. (dict) <br>Options: | If random is yes and host did not exist or update_password is yes
&nbsp; | `randompassword` - The generated random password | If only one host is handled by the module
&nbsp; | `name` - The host name of the host that got a new random password. (dict) <br> Options: <br> &nbsp; `randompassword` - The generated random password | If several hosts are handled by the module
&nbsp; | `randompassword` - The generated random password | If only one host is handled by the module without using the `hosts` parameter.
&nbsp; | `name` - The host name of the host that got a new random password. (dict) <br> Options: <br> &nbsp; `randompassword` - The generated random password | If several hosts are handled by the module with the `hosts` parameter.
Authors

179
README-netgroup.md Normal file
View File

@@ -0,0 +1,179 @@
Netgroup module
============
Description
-----------
The netgroup module allows to ensure presence and absence of netgroups.
Features
--------
* Netgroup management
Supported FreeIPA Versions
--------------------------
FreeIPA versions 4.4.0 and up are supported by the ipanetgroup module.
Requirements
------------
**Controller**
* Ansible version: 2.8+
**Node**
* Supported FreeIPA version (see above)
Usage
=====
Example inventory file
```ini
[ipaserver]
ipaserver.test.local
```
Example playbook to make sure netgroup "my_netgroup1" is present:
```yaml
---
- name: Playbook to manage IPA netgroup.
hosts: ipaserver
become: no
tasks:
- name: Ensure netgroup my_netgroup1 is present
ipanetgroup:
ipaadmin_password: SomeADMINpassword
name: my_netgroup1
description: My netgroup 1
```
Example playbook to make sure netgroup "my_netgroup1" is absent:
```yaml
---
- name: Playbook to manage IPA netgroup.
hosts: ipaserver
become: no
tasks:
- name: Ensure netgroup my_netgroup1 is absent
ipanetgroup:
ipaadmin_password: SomeADMINpassword
name: my_netgroup1
state: absent
```
Example playbook to make sure netgroup is present with user "user1"
```yaml
---
- name: Playbook to manage IPA netgroup.
hosts: ipaserver
become: no
tasks:
- name: Ensure netgroup is present with user "user1"
ipanetgroup:
ipaadmin_password: SomeADMINpassword
name: TestNetgroup1
user: user1
action: member
```
Example playbook to make sure netgroup user, "user1", is absent
```yaml
---
- name: Playbook to manage IPA netgroup.
hosts: ipaserver
become: no
tasks:
- name: Ensure netgroup user, "user1", is absent
ipanetgroup:
ipaadmin_password: SomeADMINpassword
name: TestNetgroup1
user: "user1"
action: member
state: absent
```
Example playbook to make sure netgroup is present with members
```yaml
---
- name: Playbook to manage IPA netgroup.
hosts: ipaserver
become: no
tasks:
- name: Ensure netgroup members are present
ipanetgroup:
ipaadmin_password: SomeADMINpassword
name: TestNetgroup1
user: user1,user2
group: group1
host: host1
hostgroup: ipaservers
netgroup: admins
action: member
```
Example playbook to make sure 2 netgroups TestNetgroup1, admins are absent
```yaml
---
- name: Playbook to manage IPA netgroup.
hosts: ipaserver
become: no
tasks:
- name: Ensure netgroups are absent
ipanetgroup:
ipaadmin_password: SomeADMINpassword
name:
- TestNetgroup1
- admins
state: absent
```
Variables
---------
Variable | Description | Required
-------- | ----------- | --------
`ipaadmin_principal` | The admin principal is a string and defaults to `admin` | no
`ipaadmin_password` | The admin password is a string and is required if there is no admin ticket available on the node | no
`ipaapi_context` | The context in which the module will execute. Executing in a server context is preferred. If not provided context will be determined by the execution environment. Valid values are `server` and `client`. | no
`ipaapi_ldap_cache` | Use LDAP cache for IPA connection. The bool setting defaults to yes. (bool) | no
`name` \| `cn` | The list of netgroup name strings. | yes
`description` | Netgroup description | no
`nisdomain` | NIS domain name | no
`nomembers` | Suppress processing of membership attributes. (bool) | no
`user` | List of user name strings assigned to this netgroup. | no
`group` | List of group name strings assigned to this netgroup. | no
`host` | List of host name strings assigned to this netgroup. | no
`hostgroup` | List of hostgroup name strings assigned to this netgroup. | no
`netgroup` | List of netgroup name strings assigned to this netgroup. | no
`action` | Work on group or member level. It can be on of `member` or `netgroup` and defaults to `netgroup`. | no
`state` | The state to ensure. It can be one of `present`, `absent`, default: `present`. | no
Authors
=======
Denis Karpelevich

View File

@@ -87,6 +87,36 @@ Example playbook to ensure maxlife is set to 49 in global policy:
maxlife: 49
```
Example playbook to ensure password grace period is set to 3 in global policy:
```yaml
---
- name: Playbook to handle pwpolicies
hosts: ipaserver
become: true
tasks:
# Ensure maxlife is set to 49 in global policy
- ipapwpolicy:
ipaadmin_password: SomeADMINpassword
gracelimit: 3
```
Example playbook to ensure password grace period is set to unlimited in global policy:
```yaml
---
- name: Playbook to handle pwpolicies
hosts: ipaserver
become: true
tasks:
# Ensure maxlife is set to 49 in global policy
- ipapwpolicy:
ipaadmin_password: SomeADMINpassword
gracelimit: -1
```
Variables
=========
@@ -107,6 +137,11 @@ Variable | Description | Required
`maxfail` \| `krbpwdmaxfailure` | Consecutive failures before lockout. (int) | no
`failinterval` \| `krbpwdfailurecountinterval` | Period after which failure count will be reset in seconds. (int) | no
`lockouttime` \| `krbpwdlockoutduration` | Period for which lockout is enforced in seconds. (int) | no
`maxrepeat` \| `ipapwdmaxrepeat` | Maximum number of same consecutive characters. Requires IPA 4.9+ (int) | no
`maxsequence` \| `ipapwdmaxsequence` | The maximum length of monotonic character sequences (abcd). Requires IPA 4.9+ (int) | no
`dictcheck` \| `ipapwdictcheck` | Check if the password is a dictionary word. Requires IPA 4.9+ (int) | no
`usercheck` \| `ipapwdusercheck` | Check if the password contains the username. Requires IPA 4.9+ (int) | no
`gracelimit` \| `passwordgracelimit` | Number of LDAP authentications allowed after expiration. Requires IPA 4.9.10 (int) | no
`state` | The state to ensure. It can be one of `present` or `absent`, default: `present`. | yes

View File

@@ -129,6 +129,7 @@ Variable | Description | Required
`nomembers` | Suppress processing of membership attributes. (bool) | no
`host` | List of host name strings assigned to this sudorule. | no
`hostgroup` | List of host group name strings assigned to this sudorule. | no
`hostmask` | List of host masks of allowed hosts | no
`user` | List of user name strings assigned to this sudorule. | no
`group` | List of user group name strings assigned to this sudorule. | no
`allow_sudocmd` | List of sudocmd name strings assigned to the allow group of this sudorule. | no

View File

@@ -381,8 +381,8 @@ Variable | Description | Required
Variable | Description | Required
-------- | ----------- | --------
`first` \| `givenname` | The first name string. | no
`last` \| `sn` | The last name string. | no
`first` \| `givenname` | The first name string. Required if user does not exist. | no
`last` \| `sn` | The last name string. Required if user does not exist. | no
`fullname` \| `cn` | The full name string. | no
`displayname` | The display name string. | no
`homedir` | The home directory string. | no
@@ -393,8 +393,8 @@ Variable | Description | Required
`passwordexpiration` \| `krbpasswordexpiration` | The kerberos password expiration date. Possible formats: `YYYYMMddHHmmssZ`, `YYYY-MM-ddTHH:mm:ssZ`, `YYYY-MM-ddTHH:mmZ`, `YYYY-MM-ddZ`, `YYYY-MM-dd HH:mm:ssZ` or `YYYY-MM-dd HH:mmZ`. The trailing 'Z' can be skipped. Only usable with IPA versions 4.7 and up. | no
`password` | The user password string. | no
`random` | Generate a random user password | no
`uid` \| `uidnumber` | The UID integer. | no
`gid` \| `gidnumber` | The GID integer. | no
`uid` \| `uidnumber` | User ID Number (system will assign one if not provided). | no
`gid` \| `gidnumber` | Group ID Number. | no
`city` | City | no
`userstate` \| `st` | State/Province | no
`postalcode` \| `zip` | Postalcode/ZIP | no
@@ -434,8 +434,8 @@ There are only return values if one or more random passwords have been generated
Variable | Description | Returned When
-------- | ----------- | -------------
`user` | User dict with random password. (dict) <br>Options: | If random is yes and user did not exist or update_password is yes
&nbsp; | `randompassword` - The generated random password | If only one user is handled by the module
&nbsp; | `name` - The user name of the user that got a new random password. (dict) <br> Options: <br> &nbsp; `randompassword` - The generated random password | If several users are handled by the module
&nbsp; | `randompassword` - The generated random password | If only one user is handled by the module without using the `users` parameter.
&nbsp; | `name` - The user name of the user that got a new random password. (dict) <br> Options: <br> &nbsp; `randompassword` - The generated random password | If several users are handled by the module with the `users` parameter.
Authors

View File

@@ -222,8 +222,8 @@ Variable | Description | Required
`password_file` \| `vault_password_file` \| `old_password_file`| File containing Base64 encoded Vault password. | no
`new_password` | Vault new password. | no
`new_password_file` | File containing Base64 encoded new Vault password. | no
`public_key ` \| `vault_public_key` \| `ipavaultpublickey` | Base64 encoded vault public key. | no
`public_key_file` \| `vault_public_key_file` | Path to file with public key. | no
`public_key ` \| `vault_public_key` \| `ipavaultpublickey` \| `new_public_key` | Base64 encoded vault public key. | no
`public_key_file` \| `vault_public_key_file` \| `new_public_key_file` | Path to file with public key. | no
`private_key `\| `vault_private_key` \| `ipavaultprivatekey` | Base64 encoded vault private key. Used only to retrieve data. | no
`private_key_file` \| `vault_private_key_file` | Path to file with private key. Used only to retrieve data. | no
`salt` \| `vault_salt` \| `ipavaultsalt` | Vault salt. | no

View File

@@ -17,6 +17,7 @@ Features
* Modules for automount key management
* Modules for automount location management
* Modules for automount map management
* Modules for certificate management
* Modules for config management
* Modules for delegation management
* Modules for dns config management
@@ -31,6 +32,7 @@ Features
* Modules for hostgroup management
* Modules for idrange management
* Modules for location management
* Modules for netgroup management
* Modules for permission management
* Modules for privilege management
* Modules for pwpolicy management
@@ -68,7 +70,6 @@ Requirements
**Controller**
* Ansible version: 2.8+ (ansible-freeipa is an Ansible Collection)
* /usr/bin/kinit is required on the controller if a one time password (OTP) is used
**Node**
* Supported FreeIPA version (see above)
@@ -288,7 +289,7 @@ ipaserver_domain=test.local
ipaserver_realm=TEST.LOCAL
```
For enhanced security it is possible to use a auto-generated one-time-password (OTP). This will be generated on the controller using the (first) server.
For enhanced security it is possible to use a auto-generated one-time-password (OTP). This will be generated on the (first) server.
To enable the generation of the one-time-password:
```yaml
@@ -436,6 +437,7 @@ Modules in plugin/modules
* [ipaautomountkey](README-automountkey.md)
* [ipaautomountlocation](README-automountlocation.md)
* [ipaautomountmap](README-automountmap.md)
* [ipacert](README-cert.md)
* [ipaconfig](README-config.md)
* [ipadelegation](README-delegation.md)
* [ipadnsconfig](README-dnsconfig.md)
@@ -450,6 +452,7 @@ Modules in plugin/modules
* [ipahostgroup](README-hostgroup.md)
* [idrange](README-idrange.md)
* [ipalocation](README-location.md)
* [ipanetgroup](README-netgroup.md)
* [ipapermission](README-permission.md)
* [ipaprivilege](README-privilege.md)
* [ipapwpolicy](README-pwpolicy.md)

View File

@@ -13,8 +13,8 @@ homepage: "https://github.com/freeipa/ansible-freeipa"
issues: "https://github.com/freeipa/ansible-freeipa/issues"
readme: "README.md"
license: "GPL-3.0-or-later"
license:
- "GPL-3.0-or-later"
tags:
- "linux"
- "system"

View File

@@ -4,7 +4,7 @@
become: no
tasks:
- name: ensure map TestMap is absent
- name: Ensure map TestMap is absent
ipaautomountmap:
ipaadmin_password: SomeADMINpassword
name: TestMap

View File

@@ -4,7 +4,7 @@
become: no
tasks:
- name: ensure map TestMap is present
- name: Ensure map TestMap is present
ipaautomountmap:
ipaadmin_password: SomeADMINpassword
name: TestMap

View File

@@ -0,0 +1,14 @@
- name: Certificate manage example
hosts: ipaserver
become: false
gather_facts: false
module_defaults:
ipacert:
ipaadmin_password: SomeADMINpassword
ipaapi_context: client
tasks:
- name: Temporarily hold a certificate
ipacert:
serial_number: 12345
state: held

View File

@@ -0,0 +1,15 @@
---
- name: Certificate manage example
hosts: ipaserver
become: false
gather_facts: false
module_defaults:
ipacert:
ipaadmin_password: SomeADMINpassword
ipaapi_context: client
tasks:
- name: Release a certificate hold
ipacert:
serial_number: 12345
state: released

View File

@@ -0,0 +1,26 @@
---
- name: Certificate manage example
hosts: ipaserver
become: false
gather_facts: false
module_defaults:
ipacert:
ipaadmin_password: SomeADMINpassword
ipaapi_context: client
tasks:
- name: Request a certificate for a host
ipacert:
csr: |
-----BEGIN CERTIFICATE REQUEST-----
MIIBWjCBxAIBADAbMRkwFwYDVQQDDBBob3N0LmV4YW1wbGUuY29tMIGfMA0GCSqG
SIb3DQEBAQUAA4GNADCBiQKBgQCzR3Vd4Cwl0uVgwB3+wxz+4JldFk3x526bPeuK
g8EEc+rEHILzJWeXC8ywCYPOgK9n7hrdMfVQiIx3yHYrY+0IYuLehWow4o1iJEf5
urPNAP9K9C4Y7MMXzzoQmoWR3IFQQpOYwvWOtiZfvrhmtflnYEGLE2tgz53gOQHD
NnbCCwIDAQABoAAwDQYJKoZIhvcNAQELBQADgYEAgF+6YC39WhnvmFgNz7pjAh5E
2ea3CgG+zrzAyiSBGG6WpXEjqMRnAQxciQNGxQacxjwWrscZidZzqg8URJPugewq
tslYB1+RkZn+9UWtfnWvz89+xnOgco7JlytnbH10Nfxt5fXXx13rY0tl54jBtk2W
422eYZ12wb4gjNcQy3A=
-----END CERTIFICATE REQUEST-----
principal: host/host.example.com
state: requested

View File

@@ -0,0 +1,23 @@
---
- name: Certificate manage example
hosts: ipaserver
become: false
gather_facts: false
module_defaults:
ipacert:
ipaadmin_password: SomeADMINpassword
ipaapi_context: client
tasks:
- name: Request a certificate for a service
ipacert:
csr: |
-----BEGIN CERTIFICATE REQUEST-----
MIGYMEwCAQAwGTEXMBUGA1UEAwwOZnJlZWlwYSBydWxlcyEwKjAFBgMrZXADIQBs
HlqIr4b/XNK+K8QLJKIzfvuNK0buBhLz3LAzY7QDEqAAMAUGAytlcANBAF4oSCbA
5aIPukCidnZJdr491G4LBE+URecYXsPknwYb+V+ONnf5ycZHyaFv+jkUBFGFeDgU
SYaXm/gF8cDYjQI=
-----END CERTIFICATE REQUEST-----
principal: HTTP/www.example.com
add: true
state: requested

View File

@@ -0,0 +1,27 @@
---
- name: Certificate manage example
hosts: ipaserver
become: false
gather_facts: false
module_defaults:
ipacert:
ipaadmin_password: SomeADMINpassword
ipaapi_context: client
tasks:
- name: Request a certificate for a user with a specific profile
ipacert:
csr: |
-----BEGIN CERTIFICATE REQUEST-----
MIIBejCB5AIBADAQMQ4wDAYDVQQDDAVwaW5reTCBnzANBgkqhkiG9w0BAQEFAAOB
jQAwgYkCgYEA7uChccy1Is1FTM0SF23WPYW472E3ozeLh2kzhKR9Ni6FLmeEGgu7
/hicR1VwvXHYkNwI1tpW9LqxRVvgr6vheqHySljrBcoRfshfYvKejp03l2327Bfq
BNxXqLcHylNEyg8SH0u63bWyxtgoDBfdZwdGAhYuJ+g4ev79J5eYoB0CAwEAAaAr
MCkGCSqGSIb3DQEJDjEcMBowGAYHKoZIzlYIAQQNDAtoZWxsbyB3b3JsZDANBgkq
hkiG9w0BAQsFAAOBgQADCi5BHDv1mrBFDWqYytFpQ1mrvr/mdax3AYXxNL2UEV8j
AqZAFTEnJXL/u1eVQtI1yotqxakyUBN4XZBP2CBgJRO93Mtry8cgvU1sPdU8Mavx
5gSnlP74Hio2ziscWWydlxpYxFx0gkKvu+0nyIpz954SVYwQ2wwk5FRqZnxI5w==
-----END CERTIFICATE REQUEST-----
principal: pinky
profile: IECUserRoles
state: requested

View File

@@ -0,0 +1,16 @@
---
- name: Certificate manage example
hosts: ipaserver
become: false
gather_facts: false
module_defaults:
ipacert:
ipaadmin_password: SomeADMINpassword
ipaapi_context: client
tasks:
- name: Retrieve a certificate
ipacert:
serial_number: 12345
state: retrieved
register: cert_retrieved

View File

@@ -0,0 +1,18 @@
---
- name: Certificate manage example
hosts: ipaserver
become: false
gather_facts: false
module_defaults:
ipacert:
ipaadmin_password: SomeADMINpassword
ipaapi_context: client
tasks:
- name: Permanently revoke a certificate issued by a lightweight sub-CA
ipacert:
serial_number: 12345
ca: vpn-ca
# reason: keyCompromise (1)
reason: 1
state: revoked

View File

@@ -0,0 +1,12 @@
---
- name: Playbook to change IPA domain netbios name
hosts: ipaserver
become: no
gather_facts: no
tasks:
- name: Set IPA domain netbios name
ipaconfig:
ipaadmin_password: SomeADMINpassword
enable_sid: yes
netbios_name: IPADOM

View File

@@ -0,0 +1,12 @@
---
- name: Playbook to ensure SIDs are enabled and users and groups have SIDs
hosts: ipaserver
become: no
gather_facts: no
tasks:
- name: Enable SID and generate users and groups SIDS
ipaconfig:
ipaadmin_password: SomeADMINpassword
enable_sid: yes
add_sids: yes

View File

@@ -1,5 +1,5 @@
---
- name: Playbook to handle global DNS configuration
- name: Playbook to handle global IPA configuration
hosts: ipaserver
become: no
gather_facts: no
@@ -11,5 +11,5 @@
register: serverconfig
- name: Display current configuration.
debug:
ansible.builtin.debug:
msg: "{{ serverconfig }}"

View File

@@ -1,11 +1,11 @@
---
- name: Playbook to handle global DNS configuration
- name: Playbook to handle global IPA configuration
hosts: ipaserver
become: no
gather_facts: no
tasks:
- name: set ca_renewal_master_server
- name: Set ca_renewal_master_server
ipaconfig:
ipaadmin_password: SomeADMINpassword
ca_renewal_master_server: carenewal.example.com

View File

@@ -1,5 +1,5 @@
---
- name: dnszone present
- name: All dnszone parameters
hosts: ipaserver
become: true

View File

@@ -1,5 +1,5 @@
---
- name: dnszone present
- name: Dnszone present
hosts: ipaserver
become: true

View File

@@ -11,5 +11,5 @@
register: result
- name: Zone name inferred from `name_from_ip`
debug:
ansible.builtin.debug:
msg: "Zone created: {{ result.dnszone.name }}"

View File

@@ -0,0 +1,32 @@
---
- name: Playbook to handle multiple groups
hosts: ipaserver
tasks:
- name: Create multiple groups ops, sysops
ipagroup:
ipaadmin_password: SomeADMINpassword
groups:
- name: ops
gidnumber: 1234
- name: sysops
- name: Add user and group members to groups sysops and appops
ipagroup:
ipaadmin_password: SomeADMINpassword
groups:
- name: sysops
user:
- user1
- name: appops
group:
- group2
- name: Create multiple non-POSIX and external groups
ipagroup:
ipaadmin_password: SomeADMINpassword
groups:
- name: nongroup
nonposix: true
- name: extgroup
external: true

View File

@@ -14,5 +14,5 @@
register: ipahost
- name: Print generated random password
debug:
ansible.builtin.debug:
var: ipahost.host.randompassword

View File

@@ -13,5 +13,5 @@
register: ipahost
- name: Print generated random password
debug:
ansible.builtin.debug:
var: ipahost.host.randompassword

View File

@@ -17,9 +17,9 @@
register: ipahost
- name: Print generated random password for host01.example.com
debug:
ansible.builtin.debug:
var: ipahost.host["host01.example.com"].randompassword
- name: Print generated random password for host02.example.com
debug:
ansible.builtin.debug:
var: ipahost.host["host02.example.com"].randompassword

View File

@@ -0,0 +1,12 @@
---
- name: Netgroup absent example
hosts: ipaserver
become: no
gather_facts: no
tasks:
- name: Ensure netgroup my_netgroup1 is absent
ipanetgroup:
ipaadmin_password: SomeADMINpassword
name: my_netgroup1
state: absent

View File

@@ -0,0 +1,14 @@
---
- name: Netgroup absent example
hosts: ipaserver
become: no
gather_facts: no
tasks:
- name: Ensure netgroup user, "user1", is absent
ipanetgroup:
ipaadmin_password: SomeADMINpassword
name: TestNetgroup1
user: "user1"
action: member
state: absent

View File

@@ -0,0 +1,13 @@
---
- name: Netgroup member present example
hosts: ipaserver
become: no
gather_facts: no
tasks:
- name: Ensure netgroup is present with user "user1"
ipanetgroup:
ipaadmin_password: SomeADMINpassword
name: TestNetgroup1
user: user1
action: member

View File

@@ -0,0 +1,12 @@
---
- name: Netgroup present example
hosts: ipaserver
become: no
gather_facts: no
tasks:
- name: Ensure netgroup my_netgroup1 is present
ipanetgroup:
ipaadmin_password: SomeADMINpassword
name: my_netgroup1
description: My netgroup 1

View File

@@ -0,0 +1,11 @@
---
- name: Playbook to manage password policy
hosts: ipaserver
become: no
gather_facts: no
tasks:
- name: Set password policy grace limit.
ipapwpolicy:
ipaadmin_password: SomeADMINpassword
gracelimit: 3

View File

@@ -0,0 +1,14 @@
---
- name: Playbook to manage password policy
hosts: ipaserver
become: no
gather_facts: no
tasks:
- name: Set password checking parameters.
ipapwpolicy:
ipaadmin_password: SomeADMINpassword
maxrepeat: 2
maxsequence: 3
dictcheck: yes
usercheck: yes

View File

@@ -0,0 +1,14 @@
---
- name: Playbook to manage sudorule
hosts: ipaserver
become: no
gather_facts: no
tasks:
- name: Ensure hostmask network is absent in sudorule
ipasudorule:
ipaadmin_password: SomeADMINpassword
name: testrule1
hostmask: 192.168.122.37/24
action: member
state: absent

View File

@@ -0,0 +1,13 @@
---
- name: Playbook to manage sudorule
hosts: ipaserver
become: no
gather_facts: no
tasks:
- name: Ensure hostmask network is present in sudorule
ipasudorule:
ipaadmin_password: SomeADMINpassword
name: testrule1
hostmask: 192.168.122.37/24
action: member

View File

@@ -4,7 +4,7 @@
become: true
tasks:
- name: ensure the trust is present
- name: Ensure the trust is present
ipatrust:
ipaadmin_password: SomeADMINpassword
realm: windows.local

View File

@@ -4,7 +4,7 @@
become: true
tasks:
- name: ensure the trust is absent
- name: Ensure the trust is absent
ipatrust:
ipaadmin_password: SomeADMINpassword
realm: windows.local

View File

@@ -15,5 +15,5 @@
register: ipauser
- name: Print generated random password
debug:
ansible.builtin.debug:
var: ipauser.user.randompassword

View File

@@ -20,9 +20,9 @@
register: ipauser
- name: Print generated random password for user1
debug:
ansible.builtin.debug:
var: ipauser.user.user1.randompassword
- name: Print generated random password for user2
debug:
ansible.builtin.debug:
var: ipauser.user.user2.randompassword

View File

@@ -15,5 +15,5 @@
register: result
no_log: true
- name: Display retrieved data.
debug:
ansible.builtin.debug:
msg: "Data: {{ result.vault.data }}"

View File

@@ -15,5 +15,5 @@
register: result
no_log: true
- name: Display retrieved data.
debug:
ansible.builtin.debug:
msg: "Data: {{ result.vault.data }}"

View File

@@ -6,7 +6,7 @@
tasks:
- name: Copy file containing password to server.
copy:
ansible.builtin.copy:
src: "{{ playbook_dir }}/password.txt"
dest: "{{ ansible_facts['env'].HOME }}/password.txt"
owner: "{{ ansible_user }}"
@@ -20,6 +20,6 @@
vault_type: symmetric
vault_password_file: "{{ ansible_facts['env'].HOME }}/password.txt"
- name: Remove file containing password from server.
file:
ansible.builtin.file:
path: "{{ ansible_facts['env'].HOME }}/password.txt"
state: absent

View File

@@ -11,7 +11,7 @@
tasks:
- name: Copy public key file to server.
copy:
ansible.builtin.copy:
src: "{{ playbook_dir }}/public.pem"
dest: "{{ ansible_facts['env'].HOME }}/public.pem"
owner: "{{ ansible_user }}"
@@ -25,6 +25,6 @@
vault_type: asymmetric
vault_public_key_file: "{{ ansible_facts['env'].HOME }}/public.pem"
- name: Remove public key file from server.
file:
ansible.builtin.file:
path: "{{ ansible_facts['env'].HOME }}/public.pem"
state: absent

View File

@@ -30,15 +30,18 @@ options:
ipaadmin_principal:
description: The admin principal.
default: admin
type: str
ipaadmin_password:
description: The admin password.
required: false
type: str
ipaapi_context:
description: |
The context in which the module will execute. Executing in a
server context is preferred. If not provided context will be
determined by the execution environment.
choices: ["server", "client"]
type: str
required: false
ipaapi_ldap_cache:
description: Use LDAP cache for IPA connection.

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,9 @@
# Authors:
# Mark Hahl <mhahl@redhat.com>
# Jake Reynolds <jakealexis@gmail.com>
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2021 Red Hat
# Copyright (C) 2021-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -34,21 +35,24 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipaautomember
short description: Add and delete FreeIPA Auto Membership Rules.
short_description: Add and delete FreeIPA Auto Membership Rules.
description: Add, modify and delete an IPA Auto Membership Rules.
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description: The automember rule
required: true
required: false
type: list
elements: str
aliases: ["cn"]
description:
description: A description of this auto member rule
required: false
type: str
automember_type:
description: Grouping to which the rule applies
required: true
required: false
type: str
choices: ["group", "hostgroup"]
exclusive:
@@ -56,7 +60,7 @@ options:
type: list
elements: dict
aliases: ["automemberexclusiveregex"]
options:
suboptions:
key:
description: The attribute of the regex
type: str
@@ -70,7 +74,7 @@ options:
type: list
elements: dict
aliases: ["automemberinclusiveregex"]
options:
suboptions:
key:
description: The attribute of the regex
type: str
@@ -82,10 +86,12 @@ options:
users:
description: Users to rebuild membership for.
type: list
elements: str
required: false
hosts:
description: Hosts to rebuild membership for.
type: list
elements: str
required: false
no_wait:
description: Don't wait for rebuilding membership.
@@ -95,16 +101,18 @@ options:
type: str
action:
description: Work on automember or member level
type: str
default: automember
choices: ["member", "automember"]
state:
description: State to ensure
type: str
default: present
choices: ["present", "absent", "rebuilt", "orphans_removed"]
author:
- Mark Hahl
- Jake Reynolds
- Thomas Woerner
- Mark Hahl (@mhahl)
- Jake Reynolds (@jake2184)
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -208,7 +216,6 @@ EXAMPLES = """
RETURN = """
"""
from ansible.module_utils.ansible_freeipa_module import (
IPAAnsibleModule, compare_args_ipa, gen_add_del_lists, ipalib_errors, DN
)
@@ -315,7 +322,8 @@ def main():
aliases=["automemberinclusiveregex"],
default=None,
options=dict(
key=dict(type="str", required=True),
key=dict(type="str", required=True,
no_log=False),
expression=dict(type="str", required=True)
),
elements="dict",
@@ -324,12 +332,13 @@ def main():
aliases=["automemberexclusiveregex"],
default=None,
options=dict(
key=dict(type="str", required=True),
key=dict(type="str", required=True,
no_log=False),
expression=dict(type="str", required=True)
),
elements="dict",
required=False),
name=dict(type="list", aliases=["cn"],
name=dict(type="list", elements="str", aliases=["cn"],
default=None, required=False),
description=dict(type="str", default=None),
automember_type=dict(type='str', required=False,
@@ -341,8 +350,8 @@ def main():
state=dict(type="str", default="present",
choices=["present", "absent", "rebuilt",
"orphans_removed"]),
users=dict(type="list", default=None),
hosts=dict(type="list", default=None),
users=dict(type="list", elements="str", default=None),
hosts=dict(type="list", elements="str", default=None),
),
supports_check_mode=True,
)

View File

@@ -3,8 +3,9 @@
# Authors:
# Chris Procter <cprocter@redhat.com>
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2021 Red Hat
# Copyright (C) 2021-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -34,39 +35,43 @@ ANSIBLE_METADATA = {
DOCUMENTATION = '''
---
module: ipaautomountkey
author: chris procter
author:
- Chris Procter (@chr15p))
- Thomas Woerner (@t-woerner)
short_description: Manage FreeIPA autommount map
description:
- Add, delete, and modify an IPA automount map
extends_documentation_fragment:
- ipamodule_base_docs
options:
ipaadmin_principal:
description: The admin principal
default: admin
ipaadmin_password:
description: The admin password
required: False
location:
description: automount location map is in
type: str
required: True
choices: ["automountlocationcn", "automountlocation"]
aliases: ["automountlocationcn", "automountlocation"]
mapname:
description: automount map to be managed
choices: ["map", "automountmapname", "automountmap"]
type: str
aliases: ["map", "automountmapname", "automountmap"]
required: True
key:
description: automount key to be managed
type: str
required: True
choices: ["name", "automountkey"]
newkey:
aliases: ["name", "automountkey"]
rename:
description: key to change to if state is 'renamed'
required: True
choices: ["newname", "newautomountkey"]
type: str
required: False
aliases: ["new_name", "newautomountkey"]
info:
description: Mount information for the key
required: True
choices: ["information", "automountinformation"]
type: str
required: False
aliases: ["information", "automountinformation"]
state:
description: State to ensure
type: str
required: False
default: present
choices: ["present", "absent", "renamed"]
@@ -193,7 +198,7 @@ def main():
state=dict(
type='str',
choices=['present', 'absent', 'renamed'],
required=None,
required=False,
default='present',
),
location=dict(
@@ -215,6 +220,7 @@ def main():
type="str",
aliases=["name", "automountkey"],
required=True,
no_log=False,
),
info=dict(
type="str",

View File

@@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
# Authors:
# Chris Procter <cprocter@redhat.com>
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2021 Red Hat
# Copyright (C) 2021-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -32,7 +33,9 @@ ANSIBLE_METADATA = {
DOCUMENTATION = '''
---
module: ipaautomountlocation
author: chris procter
author:
- Chris Procter (@chr15p)
- Thomas Woerner (@t-woerner)
short_description: Manage FreeIPA autommount locations
description:
- Add and delete an IPA automount location
@@ -42,10 +45,13 @@ options:
name:
description: The automount location to be managed
required: true
type: list
elements: str
aliases: ["cn","location"]
state:
description: State to ensure
required: false
type: str
default: present
choices: ["present", "absent"]
'''
@@ -116,9 +122,8 @@ def main():
default='present',
choices=['present', 'absent']
),
name=dict(type="list",
name=dict(type="list", elements="str",
aliases=["cn", "location"],
default=None,
required=True
),
),

View File

@@ -2,8 +2,9 @@
# -*- coding: utf-8 -*-
# Authors:
# Chris Procter <cprocter@redhat.com>
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2021 Red Hat
# Copyright (C) 2021-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -33,31 +34,34 @@ ANSIBLE_METADATA = {
DOCUMENTATION = '''
---
module: ipaautomountmap
author: Chris Procter
author:
- Chris Procter (@chr15p)
- Thomas Woerner (@t-woerner)
short_description: Manage FreeIPA autommount map
description:
- Add, delete, and modify an IPA automount map
extends_documentation_fragment:
- ipamodule_base_docs
options:
ipaadmin_principal:
description: The admin principal.
default: admin
ipaadmin_password:
description: The admin password.
required: false
automountlocation:
description: automount location map is anchored to
choices: ["location", "automountlocationcn"]
type: str
aliases: ["location", "automountlocationcn"]
required: True
name:
description: automount map to be managed.
choices: ["mapname", "map", "automountmapname"]
type: list
elements: str
aliases: ["mapname", "map", "automountmapname"]
required: True
desc:
description: description of automount map.
choices: ["description"]
type: str
aliases: ["description"]
required: false
state:
description: State to ensure
type: str
required: false
default: present
choices: ["present", "absent"]
@@ -122,7 +126,7 @@ class AutomountMap(IPAAnsibleModule):
self.params_fail_used_invalid(invalid, state)
def get_args(self, mapname, desc): # pylint: disable=no-self-use
def get_args(self, mapname, desc):
# automountmapname is required for all automountmap operations.
if not mapname:
self.fail_json(msg="automountmapname cannot be None or empty.")
@@ -169,12 +173,10 @@ def main():
),
location=dict(type="str",
aliases=["automountlocation", "automountlocationcn"],
default=None,
required=True
),
name=dict(type="list",
name=dict(type="list", elements="str",
aliases=["mapname", "map", "automountmapname"],
default=None,
required=True
),
desc=dict(type="str",

571
plugins/modules/ipacert.py Normal file
View File

@@ -0,0 +1,571 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
# Sam Morris <sam@robots.org.uk>
# Rafael Guterres Jeffman <rjeffman@redhat.com>
#
# Copyright (C) 2021 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
"status": ["preview"],
}
DOCUMENTATION = """
---
module: ipacert
short description: Manage FreeIPA certificates
description: Manage FreeIPA certificates
extends_documentation_fragment:
- ipamodule_base_docs
options:
csr:
description: |
X509 certificate signing request, in RFC 7468 PEM encoding.
Only available if `state: requested`, required if `csr_file` is not
provided.
type: str
csr_file:
description: |
Path to file with X509 certificate signing request, in RFC 7468 PEM
encoding. Only available if `state: requested`, required if `csr_file`
is not provided.
type: str
principal:
description: |
Host/service/user principal for the certificate.
Required if `state: requested`. Only available if `state: requested`.
type: str
add:
description: |
Automatically add the principal if it doesn't exist (service
principals only). Only available if `state: requested`.
type: bool
aliases: ["add_principal"]
required: false
ca:
description: Name of the issuing certificate authority.
type: str
required: false
serial_number:
description: |
Certificate serial number. Cannot be used with `state: requested`.
Required for all states, except `requested`.
type: int
profile:
description: Certificate Profile to use.
type: str
aliases: ["profile_id"]
required: false
revocation_reason:
description: |
Reason for revoking the certificate. Use one of the reason strings,
or the corresponding value: "unspecified" (0), "keyCompromise" (1),
"cACompromise" (2), "affiliationChanged" (3), "superseded" (4),
"cessationOfOperation" (5), "certificateHold" (6), "removeFromCRL" (8),
"privilegeWithdrawn" (9), "aACompromise" (10).
Use only if `state: revoked`. Required if `state: revoked`.
type: raw
aliases: ['reason']
certificate_out:
description: |
Write certificate (chain if `chain` is set) to this file, on the target
node.. Use only when `state` is `requested` or `retrieved`.
type: str
required: false
state:
description: |
The state to ensure. `held` is the same as revoke with reason
"certificateHold" (6). `released` is the same as `cert-revoke-hold`
on IPA CLI, releasing the hold status of a certificate.
choices: ["requested", "held", "released", "revoked", "retrieved"]
required: true
type: str
author:
authors:
- Sam Morris (@yrro)
- Rafael Guterres Jeffman (@rjeffman)
"""
EXAMPLES = """
- name: Request a certificate for a web server
ipacert:
ipaadmin_password: SomeADMINpassword
state: requested
csr: |
-----BEGIN CERTIFICATE REQUEST-----
MIGYMEwCAQAwGTEXMBUGA1UEAwwOZnJlZWlwYSBydWxlcyEwKjAFBgMrZXADIQBs
HlqIr4b/XNK+K8QLJKIzfvuNK0buBhLz3LAzY7QDEqAAMAUGAytlcANBAF4oSCbA
5aIPukCidnZJdr491G4LBE+URecYXsPknwYb+V+ONnf5ycZHyaFv+jkUBFGFeDgU
SYaXm/gF8cDYjQI=
-----END CERTIFICATE REQUEST-----
principal: HTTP/www.example.com
register: cert
- name: Request certificate for a user, with an appropriate profile.
ipacert:
ipaadmin_password: SomeADMINpassword
csr: |
-----BEGIN CERTIFICATE REQUEST-----
MIIBejCB5AIBADAQMQ4wDAYDVQQDDAVwaW5reTCBnzANBgkqhkiG9w0BAQEFAAOB
jQAwgYkCgYEA7uChccy1Is1FTM0SF23WPYW472E3ozeLh2kzhKR9Ni6FLmeEGgu7
/hicR1VwvXHYkNwI1tpW9LqxRVvgr6vheqHySljrBcoRfshfYvKejp03l2327Bfq
BNxXqLcHylNEyg8SH0u63bWyxtgoDBfdZwdGAhYuJ+g4ev79J5eYoB0CAwEAAaAr
MCkGCSqGSIb3DQEJDjEcMBowGAYHKoZIzlYIAQQNDAtoZWxsbyB3b3JsZDANBgkq
hkiG9w0BAQsFAAOBgQADCi5BHDv1mrBFDWqYytFpQ1mrvr/mdax3AYXxNL2UEV8j
AqZAFTEnJXL/u1eVQtI1yotqxakyUBN4XZBP2CBgJRO93Mtry8cgvU1sPdU8Mavx
5gSnlP74Hio2ziscWWydlxpYxFx0gkKvu+0nyIpz954SVYwQ2wwk5FRqZnxI5w==
-----END CERTIFICATE REQUEST-----
principal: pinky
profile_id: IECUserRoles
state: requested
- name: Temporarily hold a certificate
ipacert:
ipaadmin_password: SomeADMINpassword
serial_number: 12345
state: held
- name: Remove a certificate hold
ipacert:
ipaadmin_password: SomeADMINpassword
state: released
serial_number: 12345
- name: Permanently revoke a certificate issued by a lightweight sub-CA
ipacert:
ipaadmin_password: SomeADMINpassword
state: revoked
ca: vpn-ca
serial_number: 0x98765
reason: keyCompromise
- name: Retrieve a certificate
ipacert:
ipaadmin_password: SomeADMINpassword
serial_number: 12345
state: retrieved
register: cert_retrieved
"""
RETURN = """
certificate:
description: Certificate fields and data.
returned: |
if `state` is `requested` or `retrived` and `certificate_out`
is not defined.
type: dict
contains:
certificate:
description: |
Issued X509 certificate in PEM encoding. Will include certificate
chain if `chain: true` is used.
type: list
elements: str
returned: always
issuer:
description: X509 distinguished name of issuer.
type: str
sample: CN=Certificate Authority,O=EXAMPLE.COM
returned: always
serial_number:
description: Serial number of the issued certificate.
type: int
sample: 902156300
returned: always
valid_not_after:
description: |
Time when issued certificate ceases to be valid,
in GeneralizedTime format (YYYYMMDDHHMMSSZ).
type: str
returned: always
valid_not_before:
description: |
Time when issued certificate becomes valid, in
GeneralizedTime format (YYYYMMDDHHMMSSZ).
type: str
returned: always
subject:
description: X509 distinguished name of certificate subject.
type: str
sample: CN=www.example.com,O=EXAMPLE.COM
returned: always
san_dnsname:
description: X509 Subject Alternative Name.
type: list
elements: str
sample: ['www.example.com', 'other.example.com']
returned: |
when DNSNames are present in the Subject Alternative Name
extension of the issued certificate.
revoked:
description: Revoked status of the certificate.
type: bool
returned: always
owner_user:
description: The username that owns the certificate.
type: str
returned: when `state` is `retrieved`
owner_host:
description: The host that owns the certificate.
type: str
returned: when `state` is `retrieved`
owner_service:
description: The service that owns the certificate.
type: str
returned: when `state` is `retrieved`
"""
import base64
import time
import ssl
from ansible.module_utils import six
from ansible.module_utils._text import to_text
from ansible.module_utils.ansible_freeipa_module import (
IPAAnsibleModule, certificate_loader, write_certificate_list,
)
if six.PY3:
unicode = str
# Reasons are defined in RFC 5280 sec. 5.3.1; removeFromCRL is not present in
# this list; run the module with state=released instead.
REVOCATION_REASONS = {
'unspecified': 0,
'keyCompromise': 1,
'cACompromise': 2,
'affiliationChanged': 3,
'superseded': 4,
'cessationOfOperation': 5,
'certificateHold': 6,
'removeFromCRL': 8,
'privilegeWithdrawn': 9,
'aACompromise': 10,
}
def gen_args(
module, principal=None, add_principal=None, ca=None, chain=None,
profile=None, certificate_out=None, reason=None
):
args = {}
if principal is not None:
args['principal'] = principal
if add_principal is not None:
args['add'] = add_principal
if ca is not None:
args['cacn'] = ca
if profile is not None:
args['profile_id'] = profile
if certificate_out is not None:
args['out'] = certificate_out
if chain:
args['chain'] = True
if ca:
args['cacn'] = ca
if reason is not None:
args['revocation_reason'] = get_revocation_reason(module, reason)
return args
def get_revocation_reason(module, reason):
"""Ensure revocation reasion is a valid integer code."""
reason_int = -1
try:
reason_int = int(reason)
except ValueError:
reason_int = REVOCATION_REASONS.get(reason, -1)
if reason_int not in REVOCATION_REASONS.values():
module.fail_json(msg="Invalid revocation reason: %s" % reason)
return reason_int
def parse_cert_timestamp(dt):
"""Ensure time is in GeneralizedTime format (YYYYMMDDHHMMSSZ)."""
return time.strftime(
"%Y%m%d%H%M%SZ",
time.strptime(dt, "%a %b %d %H:%M:%S %Y UTC")
)
def result_handler(_module, result, _command, _name, _args, exit_args, chain):
"""Split certificate into fields."""
if chain:
exit_args['certificate'] = [
ssl.DER_cert_to_PEM_cert(c)
for c in result['result'].get('certificate_chain', [])
]
else:
exit_args['certificate'] = [
ssl.DER_cert_to_PEM_cert(
base64.b64decode(result['result']['certificate'])
)
]
exit_args['san_dnsname'] = [
str(dnsname)
for dnsname in result['result'].get('san_dnsname', [])
]
exit_args.update({
key: result['result'][key]
for key in [
'issuer', 'subject', 'serial_number',
'revoked', 'revocation_reason'
]
if key in result['result']
})
exit_args.update({
key: result['result'][key][0]
for key in ['owner_user', 'owner_host', 'owner_service']
if key in result['result']
})
exit_args.update({
key: parse_cert_timestamp(result['result'][key])
for key in ['valid_not_after', 'valid_not_before']
if key in result['result']
})
def do_cert_request(
module, csr, principal, add_principal=None, ca=None, profile=None,
chain=None, certificate_out=None
):
"""Request a certificate."""
args = gen_args(
module, principal=principal, ca=ca, chain=chain,
add_principal=add_principal, profile=profile,
)
exit_args = {}
commands = [[to_text(csr), "cert_request", args]]
changed = module.execute_ipa_commands(
commands,
result_handler=result_handler,
exit_args=exit_args,
chain=chain
)
if certificate_out is not None:
certs = (
certificate_loader(cert.encode("utf-8"))
for cert in exit_args['certificate']
)
write_certificate_list(certs, certificate_out)
exit_args = {}
return changed, exit_args
def do_cert_revoke(ansible_module, serial_number, reason=None, ca=None):
"""Revoke a certificate."""
_ign, cert = do_cert_retrieve(ansible_module, serial_number, ca)
if not cert or cert.get('revoked', False):
return False, cert
args = gen_args(ansible_module, ca=ca, reason=reason)
commands = [[serial_number, "cert_revoke", args]]
changed = ansible_module.execute_ipa_commands(commands)
return changed, cert
def do_cert_release(ansible_module, serial_number, ca=None):
"""Release hold on certificate."""
_ign, cert = do_cert_retrieve(ansible_module, serial_number, ca)
revoked = cert.get('revoked', True)
reason = cert.get('revocation_reason', -1)
if cert and not revoked:
return False, cert
if revoked and reason != 6: # can only release held certificates
ansible_module.fail_json(
msg="Cannot release hold on certificate revoked with"
" reason: %d" % reason
)
args = gen_args(ansible_module, ca=ca)
commands = [[serial_number, "cert_remove_hold", args]]
changed = ansible_module.execute_ipa_commands(commands)
return changed, cert
def do_cert_retrieve(
module, serial_number, ca=None, chain=None, outfile=None
):
"""Retrieve a certificate with 'cert-show'."""
args = gen_args(module, ca=ca, chain=chain, certificate_out=outfile)
exit_args = {}
commands = [[serial_number, "cert_show", args]]
module.execute_ipa_commands(
commands,
result_handler=result_handler,
exit_args=exit_args,
chain=chain,
)
if outfile is not None:
exit_args = {}
return False, exit_args
def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# requested
csr=dict(type="str"),
csr_file=dict(type="str"),
principal=dict(type="str"),
add_principal=dict(type="bool", required=False, aliases=["add"]),
profile_id=dict(type="str", aliases=["profile"], required=False),
# revoked
revocation_reason=dict(type="raw", aliases=["reason"]),
# general
serial_number=dict(type="int"),
ca=dict(type="str"),
chain=dict(type="bool", required=False),
certificate_out=dict(type="str", required=False),
# state
state=dict(
type="str",
required=True,
choices=[
"requested", "held", "released", "revoked", "retrieved"
]
),
),
mutually_exclusive=[["csr", "csr_file"]],
required_if=[
('state', 'requested', ['principal']),
('state', 'retrieved', ['serial_number']),
('state', 'held', ['serial_number']),
('state', 'released', ['serial_number']),
('state', 'revoked', ['serial_number', 'revocation_reason']),
],
supports_check_mode=False,
)
ansible_module._ansible_debug = True
# Get parameters
# requested
csr = ansible_module.params_get("csr")
csr_file = ansible_module.params_get("csr_file")
principal = ansible_module.params_get("principal")
add_principal = ansible_module.params_get("add_principal")
profile = ansible_module.params_get("profile_id")
# revoked
reason = ansible_module.params_get("revocation_reason")
# general
serial_number = ansible_module.params.get("serial_number")
ca = ansible_module.params_get("ca")
chain = ansible_module.params_get("chain")
certificate_out = ansible_module.params_get("certificate_out")
# state
state = ansible_module.params_get("state")
# Check parameters
if ansible_module.params_get("ipaapi_context") == "server":
ansible_module.fail_json(
msg="Context 'server' for ipacert is not yet supported."
)
invalid = []
if state == "requested":
invalid = ["serial_number", "revocation_reason"]
if csr is None and csr_file is None:
ansible_module.fail_json(
msg="Required 'csr' or 'csr_file' with 'state: requested'.")
else:
invalid = [
"csr", "principal", "add_principal", "profile"
"certificate_out"
]
if state in ["released", "held"]:
invalid.extend(["revocation_reason", "certificate_out", "chain"])
if state == "retrieved":
invalid.append("revocation_reason")
if state == "revoked":
invalid.extend(["certificate_out", "chain"])
elif state == "held":
reason = 6 # certificateHold
ansible_module.params_fail_used_invalid(invalid, state)
# Init
changed = False
exit_args = {}
# Connect to IPA API
# If executed on 'server' contexot, cert plugin uses the IPA RA agent
# TLS client certificate/key, which users are not able to access,
# resulting in a 'permission denied' exception when attempting to connect
# the CA service. Therefore 'client' context in forced for this module.
with ansible_module.ipa_connect(context="client"):
if state == "requested":
if csr_file is not None:
with open(csr_file, "rt") as csr_in:
csr = "".join(csr_in.readlines())
changed, exit_args = do_cert_request(
ansible_module,
csr,
principal,
add_principal,
ca,
profile,
chain,
certificate_out
)
elif state in ("held", "revoked"):
changed, exit_args = do_cert_revoke(
ansible_module, serial_number, reason, ca)
elif state == "released":
changed, exit_args = do_cert_release(
ansible_module, serial_number, ca)
elif state == "retrieved":
changed, exit_args = do_cert_retrieve(
ansible_module, serial_number, ca, chain, certificate_out)
# Done
ansible_module.exit_json(changed=changed, certificate=exit_args)
if __name__ == "__main__":
main()

View File

@@ -2,8 +2,9 @@
# Authors:
# Chris Procter <cprocter@redhat.com>
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2020 Red Hat
# Copyright (C) 2020-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -32,8 +33,10 @@ ANSIBLE_METADATA = {
DOCUMENTATION = '''
---
module: ipa_config
author: chris procter
module: ipaconfig
author:
- Chris Procter (@chr15p)
- Thomas Woerner (@t-woerner)
short_description: Modify IPA global config options
description:
- Modify IPA global config options
@@ -43,48 +46,60 @@ options:
maxusername:
description: Set the maximum username length between 1-255
required: false
type: int
aliases: ['ipamaxusernamelength']
maxhostname:
description: Set the maximum hostname length between 64-255
required: false
type: int
aliases: ['ipamaxhostnamelength']
homedirectory:
description: Set the default location of home directories
required: false
type: str
aliases: ['ipahomesrootdir']
defaultshell:
description: Set the default shell for new users
required: false
type: str
aliases: ['ipadefaultloginshell', 'loginshell']
defaultgroup:
description: Set the default group for new users
required: false
type: str
aliases: ['ipadefaultprimarygroup']
emaildomain:
description: Set the default e-mail domain
required: false
type: str
aliases: ['ipadefaultemaildomain']
searchtimelimit:
description:
- Set maximum amount of time (seconds) for a search
- values -1 to 2147483647 (-1 or 0 is unlimited)
required: false
type: int
aliases: ['ipasearchtimelimit']
searchrecordslimit:
description:
- Set maximum number of records to search
- values -1 to 2147483647 (-1 or 0 is unlimited)
required: false
type: int
aliases: ['ipasearchrecordslimit']
usersearch:
description:
- Set comma-separated list of fields to search for user search
required: false
type: list
elements: str
aliases: ['ipausersearchfields']
groupsearch:
description:
- Set comma-separated list of fields to search for group search
required: false
type: list
elements: str
aliases: ['ipagroupsearchfields']
enable_migration:
description: Enable migration mode
@@ -95,22 +110,26 @@ options:
description: Set default group objectclasses (comma-separated list)
required: false
type: list
elements: str
aliases: ['ipagroupobjectclasses']
userobjectclasses:
description: Set default user objectclasses (comma-separated list)
required: false
type: list
elements: str
aliases: ['ipauserobjectclasses']
pwdexpnotify:
description:
- Set number of days's notice of impending password expiration
- values 0 to 2147483647
required: false
type: int
aliases: ['ipapwdexpadvnotify']
configstring:
description: Set extra hashes to generate in password plug-in
required: false
type: list
elements: str
choices:
- "AllowNThash"
- "KDC:Disable Last Success"
@@ -122,32 +141,55 @@ options:
description: Set order in increasing priority of SELinux users
required: false
type: list
elements: str
aliases: ['ipaselinuxusermaporder']
selinuxusermapdefault:
description: Set default SELinux user when no match found in map rule
required: false
type: str
aliases: ['ipaselinuxusermapdefault']
pac_type:
description: set default types of PAC supported for services
required: false
type: list
elements: str
choices: ["MS-PAC", "PAD", "nfs:NONE", ""]
aliases: ["ipakrbauthzdata"]
user_auth_type:
description: set default types of supported user authentication
required: false
type: list
elements: str
choices: ["password", "radius", "otp", "disabled", ""]
aliases: ["ipauserauthtype"]
ca_renewal_master_server:
description: Renewal master for IPA certificate authority.
required: false
type: string
type: str
domain_resolution_order:
description: set list of domains used for short name qualification
required: false
type: list
elements: str
aliases: ["ipadomainresolutionorder"]
enable_sid:
description: >
New users and groups automatically get a SID assigned.
Cannot be deactivated once activated. Requires IPA 4.9.8+.
required: false
type: bool
netbios_name:
description: >
NetBIOS name of the IPA domain. Requires IPA 4.9.8+
and SID generation to be activated.
required: false
type: str
add_sids:
description: >
Add SIDs for existing users and groups. Requires IPA 4.9.8+
and SID generation to be activated.
required: false
type: bool
'''
EXAMPLES = '''
@@ -169,6 +211,24 @@ EXAMPLES = '''
ipaadmin_password: SomeADMINpassword
defaultshell: /bin/bash
maxusername: 64
- name: Playbook to enable SID and generate users and groups SIDs
hosts: ipaserver
tasks:
- name: Enable SID and generate users and groups SIDS
ipaconfig:
ipaadmin_password: SomeADMINpassword
enable_sid: yes
add_sids: yes
- name: Playbook to change IPA domain netbios name
hosts: ipaserver
tasks:
- name: Enable SID and generate users and groups SIDS
ipaconfig:
ipaadmin_password: SomeADMINpassword
enable_sid: yes
netbios_name: IPADOM
'''
RETURN = '''
@@ -176,38 +236,48 @@ config:
description: Dict of all global config options
returned: When no options are set
type: dict
options:
contains:
maxusername:
description: maximum username length
type: int
returned: always
maxhostname:
description: maximum hostname length
type: int
returned: always
homedirectory:
description: default location of home directories
type: str
returned: always
defaultshell:
description: default shell for new users
type: str
returned: always
defaultgroup:
description: default group for new users
type: str
returned: always
emaildomain:
description: default e-mail domain
type: str
returned: always
searchtimelimit:
description: maximum amount of time (seconds) for a search
type: int
returned: always
searchrecordslimit:
description: maximum number of records to search
type: int
returned: always
usersearch:
description: comma-separated list of fields to search in user search
description: list of fields to search in user search
type: list
elements: str
returned: always
groupsearch:
description: comma-separated list of fields to search in group search
description: list of fields to search in group search
type: list
elements: str
returned: always
enable_migration:
description: Enable migration mode
@@ -216,37 +286,59 @@ config:
groupobjectclasses:
description: default group objectclasses (comma-separated list)
type: list
elements: str
returned: always
userobjectclasses:
description: default user objectclasses (comma-separated list)
type: list
elements: str
returned: always
pwdexpnotify:
description: number of days's notice of impending password expiration
type: str
returned: always
configstring:
description: extra hashes to generate in password plug-in
type: list
elements: str
returned: always
selinuxusermaporder:
description: order in increasing priority of SELinux users
type: list
elements: str
returned: always
selinuxusermapdefault:
description: default SELinux user when no match is found in map rule
type: str
returned: always
pac_type:
description: default types of PAC supported for services
type: list
elements: str
returned: always
user_auth_type:
description: default types of supported user authentication
type: str
returned: always
ca_renewal_master_server:
description: master for IPA certificate authority.
type: str
returned: always
domain_resolution_order:
description: list of domains used for short name qualification
type: list
elements: str
returned: always
enable_sid:
description: >
new users and groups automatically get a SID assigned.
Requires IPA 4.9.8+.
type: str
returned: always
netbios_name:
description: NetBIOS name of the IPA domain. Requires IPA 4.9.8+.
type: str
returned: if enable_sid is True
'''
@@ -260,6 +352,28 @@ def config_show(module):
return _result["result"]
def get_netbios_name(module):
try:
_result = module.ipa_command_no_name("trustconfig_show", {"all": True})
except Exception: # pylint: disable=broad-except
return None
else:
return _result["result"]["ipantflatname"][0]
def is_enable_sid(module):
"""When 'enable_sid' is true admin user and admins group have SID set."""
_result = module.ipa_command("user_show", "admin", {"all": True})
sid = _result["result"].get("ipantsecurityidentifier", [""])
if not sid[0].endswith("-500"):
return False
_result = module.ipa_command("group_show", "admins", {"all": True})
sid = _result["result"].get("ipantsecurityidentifier", [""])
if not sid[0].endswith("-512"):
return False
return True
def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
@@ -281,39 +395,45 @@ def main():
aliases=['ipasearchtimelimit']),
searchrecordslimit=dict(type="int", required=False,
aliases=['ipasearchrecordslimit']),
usersearch=dict(type="list", required=False,
usersearch=dict(type="list", elements="str", required=False,
aliases=['ipausersearchfields']),
groupsearch=dict(type="list", required=False,
groupsearch=dict(type="list", elements="str", required=False,
aliases=['ipagroupsearchfields']),
enable_migration=dict(type="bool", required=False,
aliases=['ipamigrationenabled']),
groupobjectclasses=dict(type="list", required=False,
groupobjectclasses=dict(type="list", elements="str",
required=False,
aliases=['ipagroupobjectclasses']),
userobjectclasses=dict(type="list", required=False,
userobjectclasses=dict(type="list", elements="str", required=False,
aliases=['ipauserobjectclasses']),
pwdexpnotify=dict(type="int", required=False,
aliases=['ipapwdexpadvnotify']),
configstring=dict(type="list", required=False,
configstring=dict(type="list", elements="str", required=False,
aliases=['ipaconfigstring'],
choices=["AllowNThash",
"KDC:Disable Last Success",
"KDC:Disable Lockout",
"KDC:Disable Default Preauth for SPNs",
""]), # noqa E128
selinuxusermaporder=dict(type="list", required=False,
selinuxusermaporder=dict(type="list", elements="str",
required=False,
aliases=['ipaselinuxusermaporder']),
selinuxusermapdefault=dict(type="str", required=False,
aliases=['ipaselinuxusermapdefault']),
pac_type=dict(type="list", required=False,
pac_type=dict(type="list", elements="str", required=False,
aliases=["ipakrbauthzdata"],
choices=["MS-PAC", "PAD", "nfs:NONE", ""]),
user_auth_type=dict(type="list", required=False,
user_auth_type=dict(type="list", elements="str", required=False,
choices=["password", "radius", "otp",
"disabled", ""],
aliases=["ipauserauthtype"]),
ca_renewal_master_server=dict(type="str", required=False),
domain_resolution_order=dict(type="list", required=False,
aliases=["ipadomainresolutionorder"])
domain_resolution_order=dict(type="list", elements="str",
required=False,
aliases=["ipadomainresolutionorder"]),
enable_sid=dict(type="bool", required=False),
add_sids=dict(type="bool", required=False),
netbios_name=dict(type="str", required=False),
),
supports_check_mode=True,
)
@@ -344,7 +464,10 @@ def main():
"pac_type": "ipakrbauthzdata",
"user_auth_type": "ipauserauthtype",
"ca_renewal_master_server": "ca_renewal_master_server",
"domain_resolution_order": "ipadomainresolutionorder"
"domain_resolution_order": "ipadomainresolutionorder",
"enable_sid": "enable_sid",
"netbios_name": "netbios_name",
"add_sids": "add_sids",
}
allow_empty_string = ["pac_type", "user_auth_type", "configstring"]
reverse_field_map = {v: k for k, v in field_map.items()}
@@ -394,11 +517,52 @@ def main():
changed = False
exit_args = {}
# Connect to IPA API
with ansible_module.ipa_connect():
# Connect to IPA API (enable_sid requires context == 'client')
with ansible_module.ipa_connect(context="client"):
has_enable_sid = ansible_module.ipa_command_param_exists(
"config_mod", "enable_sid")
result = config_show(ansible_module)
if params:
enable_sid = params.get("enable_sid")
sid_is_enabled = has_enable_sid and is_enable_sid(ansible_module)
if sid_is_enabled and enable_sid is False:
ansible_module.fail_json(msg="SID cannot be disabled.")
netbios_name = params.get("netbios_name")
add_sids = params.get("add_sids")
if has_enable_sid:
if (
netbios_name
and netbios_name == get_netbios_name(ansible_module)
):
del params["netbios_name"]
netbios_name = None
if not add_sids and "add_sids" in params:
del params["add_sids"]
if any([netbios_name, add_sids]):
if sid_is_enabled:
params["enable_sid"] = True
else:
if not enable_sid:
ansible_module.fail_json(
msg="SID generation must be enabled for "
"'netbios_name' and 'add_sids'. Use "
"'enable_sid: yes'."
)
else:
if sid_is_enabled and "enable_sid" in params:
del params["enable_sid"]
else:
if any([enable_sid, netbios_name, add_sids is not None]):
ansible_module.fail_json(
msg="This version of IPA does not support enable_sid, "
"add_sids or netbios_name setting through the "
"config module"
)
params = {
k: v for k, v in params.items()
if k not in result or result[k] != v
@@ -458,6 +622,10 @@ def main():
# Add empty domain_resolution_order if it is not set
if "domain_resolution_order" not in exit_args:
exit_args["domain_resolution_order"] = []
# Set enable_sid
if has_enable_sid:
exit_args["enable_sid"] = is_enable_sid(ansible_module)
exit_args["netbios_name"] = get_netbios_name(ansible_module)
# Done
ansible_module.exit_json(changed=changed, config=exit_args)

View File

@@ -3,7 +3,7 @@
# Authors:
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2020 Red Hat
# Copyright (C) 2020-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -32,40 +32,52 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipadelegation
short description: Manage FreeIPA delegations
short_description: Manage FreeIPA delegations
description: Manage FreeIPA delegations and delegation attributes
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description: The list of delegation name strings.
type: list
elements: str
required: true
aliases: ["aciname"]
permission:
description: Permissions to grant (read, write). Default is write.
type: list
elements: str
required: false
aliases: ["permissions"]
attribute:
description: Attribute list to which the delegation applies
type: list
elements: str
required: false
aliases: ["attrs"]
membergroup:
description: User group to apply delegation to
type: str
required: false
aliases: ["memberof"]
group:
description: User group ACI grants access to
type: str
required: false
action:
description: Work on delegation or member level.
type: str
choices: ["delegation", "member"]
default: delegation
required: false
state:
description: The state to ensure.
type: str
choices: ["present", "absent"]
default: present
required: true
required: false
author:
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -143,13 +155,13 @@ def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["aciname"], default=None,
name=dict(type="list", elements="str", aliases=["aciname"],
required=True),
# present
permission=dict(required=False, type='list',
permission=dict(required=False, type='list', elements="str",
aliases=["permissions"], default=None),
attribute=dict(required=False, type='list', aliases=["attrs"],
default=None),
attribute=dict(required=False, type='list', elements="str",
aliases=["attrs"], default=None),
membergroup=dict(type="str", aliases=["memberof"], default=None),
group=dict(type="str", default=None),
action=dict(type="str", default="delegation",

View File

@@ -2,8 +2,9 @@
# Authors:
# Rafael Guterres Jeffman <rjeffman@redhat.com>
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2019 Red Hat
# Copyright (C) 2019-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -33,7 +34,7 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipadnsconfig
short description: Manage FreeIPA dnsconfig
short_description: Manage FreeIPA dnsconfig
description: Manage FreeIPA dnsconfig
extends_documentation_fragment:
- ipamodule_base_docs
@@ -41,20 +42,25 @@ options:
forwarders:
description: The list of global DNS forwarders.
required: false
options:
type: list
elements: dict
suboptions:
ip_address:
description: The forwarder nameserver IP address list (IPv4 and IPv6).
type: str
required: true
port:
description: The port to forward requests to.
type: int
required: false
forward_policy:
description:
Global forwarding policy. Set to "none" to disable any configured
global forwarders.
type: str
required: false
choices: ['only', 'first', 'none']
alias: ["forwardpolicy"]
aliases: ["forwardpolicy"]
allow_sync_ptr:
description:
Allow synchronization of forward (A, AAAA) and reverse (PTR) records.
@@ -64,14 +70,19 @@ options:
description: |
Work on dnsconfig or member level. It can be one of `member` or
`dnsconfig`. Only `forwarders` can be managed with `action: member`.
type: str
default: "dnsconfig"
choices: ["member", "dnsconfig"]
state:
description: |
The state to ensure. It can be one of `present` or `absent`.
`absent` can only be used with `action: member` and `forwarders`.
type: str
default: present
choices: ["present", "absent"]
author:
- Rafael Guterres Jeffman (@rjeffman)
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -183,14 +194,15 @@ def gen_args(module, state, action, dnsconfig, forwarders, forward_policy,
def main():
forwarder_spec = dict(
ip_address=dict(type=str, required=True),
port=dict(type=int, required=False, default=None)
ip_address=dict(type="str", required=True),
port=dict(type="int", required=False, default=None)
)
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# dnsconfig
forwarders=dict(type='list', default=None, required=False,
forwarders=dict(type='list', elements="dict", default=None,
required=False,
options=dict(**forwarder_spec)),
forward_policy=dict(type='str', required=False, default=None,
choices=['only', 'first', 'none'],

View File

@@ -2,8 +2,9 @@
# Authors:
# Chris Procter <cprocter@redhat.com>
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2019 Red Hat
# Copyright (C) 2019-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -32,53 +33,68 @@ ANSIBLE_METADATA = {
DOCUMENTATION = '''
---
module: ipa_dnsforwardzone
author: chris procter
module: ipadnsforwardzone
author:
- Chris Procter (@chr15p)
- Thomas Woerner (@t-woerner)
short_description: Manage FreeIPA DNS Forwarder Zones
description:
- Add and delete an IPA DNS Forwarder Zones using IPA API
- Add and delete an IPA DNS Forwarder Zones using IPA API
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description:
- The DNS zone name which needs to be managed.
type: list
elements: str
required: true
aliases: ["cn"]
action:
description: |
Work on dnsforwardzone or member level. It can be one of `member` or
`dnsforwardzone`.
type: str
default: "dnsforwardzone"
choices: ["member", "dnsforwardzone"]
state:
description: State to ensure
type: str
required: false
default: present
choices: ["present", "absent", "enabled", "disabled"]
forwarders:
description:
- List of the DNS servers to forward to
type: list
elements: dict
aliases: ["idnsforwarders"]
options:
suboptions:
ip_address:
description: Forwarder IP address (either IPv4 or IPv6).
required: false
type: string
required: true
type: str
port:
description: Forwarder port.
required: false
type: int
forwardpolicy:
description: Per-zone conditional forwarding policy
type: str
required: false
default: only
choices: ["only", "first", "none"]
aliases: ["idnsforwarders", "forward_policy"]
aliases: ["idnsforwardpolicy", "forward_policy"]
skip_overlap_check:
description:
- Force DNS zone creation even if it will overlap with an existing zone.
type: bool
required: false
default: false
permission:
description:
- Allow DNS Forward Zone to be managed.
required: false
type: bool
aliases: ["managedby"]
'''
EXAMPLES = '''
@@ -180,7 +196,7 @@ def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["cn"], default=None,
name=dict(type="list", elements="str", aliases=["cn"],
required=True),
forwarders=dict(type="list", default=None, required=False,
aliases=["idnsforwarders"], elements='dict',

View File

@@ -2,8 +2,9 @@
# Authors:
# Rafael Guterres Jeffman <rjeffman@redhat.com>
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2020 Red Hat
# Copyright (C) 2020-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -34,7 +35,7 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipadnsrecord
short description: Manage FreeIPA DNS records
short_description: Manage FreeIPA DNS records
description: Manage FreeIPA DNS records
extends_documentation_fragment:
- ipamodule_base_docs
@@ -42,19 +43,24 @@ options:
records:
description: The list of user dns records dicts
required: false
options:
type: list
elements: dict
suboptions:
name:
description: The DNS record name to manage.
type: str
aliases: ["record_name"]
required: true
zone_name:
description: |
The DNS zone name to which DNS record needs to be managed.
Required if not provided globally.
type: str
aliases: ["dnszone"]
required: false
record_type:
description: The type of DNS record.
type: str
choices: ["A", "AAAA", "A6", "AFSDB", "CERT", "CNAME", "DLV", "DNAME",
"DS", "KX", "LOC", "MX", "NAPTR", "NS", "PTR", "SRV",
"SSHFP", "TLSA", "TXT", "URI"]
@@ -63,6 +69,7 @@ options:
description: Manage DNS record name with these values.
required: false
type: list
elements: str
record_ttl:
description: Set the TTL for the record.
required: false
@@ -73,92 +80,132 @@ options:
type: bool
a_rec:
description: Raw A record.
type: list
elements: str
required: false
aliases: ["a_record"]
aaaa_rec:
description: Raw AAAA record.
type: list
elements: str
required: false
aliases: ["aaaa_record"]
a6_rec:
description: Raw A6 record.
type: list
elements: str
required: false
aliases: ["a6_record"]
afsdb_rec:
description: Raw AFSDB record.
type: list
elements: str
required: false
aliases: ["afsdb_record"]
cert_rec:
description: Raw CERT record.
type: list
elements: str
required: false
aliases: ["cert_record"]
cname_rec:
description: Raw CNAME record.
type: list
elements: str
required: false
aliases: ["cname_record"]
dlv_rec:
description: Raw DLV record.
type: list
elements: str
required: false
aliases: ["dlv_record"]
dname_rec:
description: Raw DNAM record.
type: list
elements: str
required: false
aliases: ["dname_record"]
ds_rec:
description: Raw DS record.
type: list
elements: str
required: false
aliases: ["ds_record"]
kx_rec:
description: Raw KX record.
type: list
elements: str
required: false
aliases: ["kx_record"]
loc_rec:
description: Raw LOC record.
type: list
elements: str
required: false
aliases: ["loc_record"]
mx_rec:
description: Raw MX record.
type: list
elements: str
required: false
aliases: ["mx_record"]
naptr_rec:
description: Raw NAPTR record.
type: list
elements: str
required: false
aliases: ["naptr_record"]
ns_rec:
description: Raw NS record.
type: list
elements: str
required: false
aliases: ["ns_record"]
ptr_rec:
description: Raw PTR record.
type: list
elements: str
required: false
aliases: ["ptr_record"]
srv_rec:
description: Raw SRV record.
type: list
elements: str
required: false
aliases: ["srv_record"]
sshfp_rec:
description: Raw SSHFP record.
type: list
elements: str
required: false
aliases: ["sshfp_record"]
tlsa_rec:
description: Raw TLSA record.
type: list
elements: str
required: false
aliases: ["tlsa_record"]
txt_rec:
description: Raw TXT record.
type: list
elements: str
required: false
aliases: ["txt_record"]
uri_rec:
description: Raw URI record.
type: list
elements: str
required: false
aliases: ["uri_record"]
ip_address:
description: IP adresses for A or AAAA records.
required: false
type: string
type: str
a_ip_address:
description: IP adresses for A records.
required: false
type: string
type: str
a_create_reverse:
description: |
Create reverse record for A records.
@@ -168,7 +215,7 @@ options:
aaaa_ip_address:
description: IP adresses for AAAA records.
required: false
type: string
type: str
aaaa_create_reverse:
description: |
Create reverse record for AAAA records.
@@ -185,6 +232,7 @@ options:
a6_data:
description: A6 record data.
required: false
type: str
afsdb_subtype:
description: AFSDB Subtype
required: false
@@ -192,7 +240,7 @@ options:
afsdb_hostname:
description: AFSDB Hostname
required: false
type: string
type: str
cert_type:
description: CERT Certificate Type
required: false
@@ -208,13 +256,13 @@ options:
cert_certificate_or_crl:
description: CERT Certificate or Certificate Revocation List (CRL).
required: false
type: string
type: str
cname_hostname:
description: A hostname which this alias hostname points to.
required: false
type: string
type: str
dlv_key_tag:
description: DS Key Tag
description: DLV Key Tag
required: false
type: int
dlv_algorithm:
@@ -228,11 +276,11 @@ options:
dlv_digest:
description: DLV Digest
required: false
type: string
type: str
dname_target:
description: DNAME Target
required: false
type: string
type: str
ds_key_tag:
description: DS Key Tag
required: false
@@ -248,7 +296,7 @@ options:
ds_digest:
description: DS Digest
required: false
type: string
type: str
kx_preference:
description: |
Preference given to this exchanger. Lower values are more preferred.
@@ -257,7 +305,7 @@ options:
kx_exchanger:
description: A host willing to act as a key exchanger.
required: false
type: string
type: str
loc_lat_deg:
description: LOC Degrees Latitude
required: false
@@ -274,6 +322,7 @@ options:
description: LOC Direction Latitude
required: false
choices: ["N", "S"]
type: str
loc_lon_deg:
description: LOC Degrees Longitude
required: false
@@ -290,6 +339,7 @@ options:
description: LOC Direction Longitude
required: false
choices: ["E", "W"]
type: str
loc_altitude:
description: LOC Altitude
required: false
@@ -314,7 +364,7 @@ options:
mx_exchanger:
description: A host willing to act as a mail exchanger.
required: false
type: string
type: str
naptr_order:
description: NAPTR Order
required: false
@@ -326,27 +376,27 @@ options:
naptr_flags:
description: NAPTR Flags
required: false
type: string
type: str
naptr_service:
description: NAPTR Service
required: false
type: string
type: str
naptr_regexp:
description: NAPTR Regular Expression
required: false
type: string
type: str
naptr_replacement:
description: NAPTR Replacement
required: false
type: string
type: str
ns_hostname:
description: NS Hostname
required: false
type: string
type: str
ptr_hostname:
description: The hostname this reverse record points to.
required: false
type: string
type: str
srv_priority:
description: |
Lower number means higher priority. Clients will attempt to contact
@@ -366,7 +416,7 @@ options:
The domain name of the target host or '.' if the service is decidedly
not available at this domain.
required: false
type: string
type: str
sshfp_algorithm:
description: SSHFP Algorithm
required: False
@@ -378,11 +428,11 @@ options:
sshfp_fingerprint:
description: SSHFP Fingerprint
required: False
type: string
type: str
txt_data:
description: TXT Text Data
required: false
type: string
type: str
tlsa_cert_usage:
description: TLSA Certificate Usage
required: false
@@ -398,11 +448,11 @@ options:
tlsa_cert_association_data:
description: TLSA Certificate Association Data
required: false
type: string
type: str
uri_target:
description: Target Uniform Resource Identifier according to RFC 3986.
required: false
type: string
type: str
uri_priority:
description: |
Lower number means higher priority. Clients will attempt to contact
@@ -413,27 +463,31 @@ options:
description: Relative weight for entries with the same priority.
required: false
type: int
name:
description: The DNS record name to manage.
type: list
elements: str
aliases: ["record_name"]
required: false
zone_name:
description: |
The DNS zone name to which DNS record needs to be managed.
Required if not provided globally.
type: str
aliases: ["dnszone"]
required: false
name:
description: The DNS record name to manage.
aliases: ["record_name"]
required: true
record_type:
description: The type of DNS record.
required: false
type: str
choices: ["A", "AAAA", "A6", "AFSDB", "CERT", "CNAME", "DLV", "DNAME",
"DS", "KX", "LOC", "MX", "NAPTR", "NS", "PTR", "SRV", "SSHFP",
"TLSA", "TXT", "URI"]
"DS", "KX", "LOC", "MX", "NAPTR", "NS", "PTR", "SRV",
"SSHFP", "TLSA", "TXT", "URI"]
default: "A"
record_value:
description: Manage DNS record name with this values.
description: Manage DNS record name with these values.
required: false
type: list
elements: str
record_ttl:
description: Set the TTL for the record.
required: false
@@ -444,99 +498,132 @@ options:
type: bool
a_rec:
description: Raw A record.
type: list
elements: str
required: false
aliases: ["a_record"]
aaaa_rec:
description: Raw AAAA record.
type: list
elements: str
required: false
aliases: ["aaaa_record"]
a6_rec:
description: Raw A6 record.
type: list
elements: str
required: false
aliases: ["a6_record"]
afsdb_rec:
description: Raw AFSDB record.
type: list
elements: str
required: false
aliases: ["afsdb_record"]
cert_rec:
description: Raw CERT record.
type: list
elements: str
required: false
aliases: ["cert_record"]
cname_rec:
description: Raw CNAME record.
type: list
elements: str
required: false
aliases: ["cname_record"]
dlv_rec:
description: Raw DLV record.
type: list
elements: str
required: false
aliases: ["dlv_record"]
dname_rec:
description: Raw DNAM record.
type: list
elements: str
required: false
aliases: ["dname_record"]
ds_rec:
description: Raw DS record.
type: list
elements: str
required: false
aliases: ["ds_record"]
kx_rec:
description: Raw KX record.
type: list
elements: str
required: false
aliases: ["kx_record"]
loc_rec:
description: Raw LOC record.
type: list
elements: str
required: false
aliases: ["loc_record"]
mx_rec:
description: Raw MX record.
type: list
elements: str
required: false
aliases: ["mx_record"]
naptr_rec:
description: Raw NAPTR record.
type: list
elements: str
required: false
aliases: ["naptr_record"]
ns_rec:
description: Raw NS record.
type: list
elements: str
required: false
aliases: ["ns_record"]
ptr_rec:
description: Raw PTR record.
type: list
elements: str
required: false
aliases: ["ptr_record"]
srv_rec:
description: Raw SRV record.
type: list
elements: str
required: false
aliases: ["srv_record"]
sshfp_rec:
description: Raw SSHFP record.
type: list
elements: str
required: false
aliases: ["sshfp_record"]
tlsa_rec:
description: Raw TLSA record.
type: list
elements: str
required: false
aliases: ["tlsa_record"]
txt_rec:
description: Raw TXT record.
type: list
elements: str
required: false
aliases: ["txt_record"]
uri_rec:
description: Raw URI record.
type: list
elements: str
required: false
aliases: ["uri_record"]
ip_address:
description: IP adresses for A ar AAAA.
description: IP adresses for A or AAAA records.
required: false
type: string
create_reverse:
description: |
Create reverse record for A or AAAA record types.
There is no equivalent to remove reverse records.
type: bool
required: false
aliases: ["reverse"]
type: str
a_ip_address:
description: IP adresses for A records.
required: false
type: string
type: str
a_create_reverse:
description: |
Create reverse record for A records.
@@ -546,13 +633,24 @@ options:
aaaa_ip_address:
description: IP adresses for AAAA records.
required: false
type: string
type: str
aaaa_create_reverse:
description: |
Create reverse record for AAAA records.
There is no equivalent to remove reverse records.
type: bool
required: false
create_reverse:
description: |
Create reverse record for A or AAAA record types.
There is no equivalent to remove reverse records.
type: bool
required: false
aliases: ["reverse"]
a6_data:
description: A6 record data.
required: false
type: str
afsdb_subtype:
description: AFSDB Subtype
required: false
@@ -560,7 +658,7 @@ options:
afsdb_hostname:
description: AFSDB Hostname
required: false
type: string
type: str
cert_type:
description: CERT Certificate Type
required: false
@@ -574,13 +672,13 @@ options:
required: false
type: int
cert_certificate_or_crl:
description: CERT Certificate/CRL
description: CERT Certificate or Certificate Revocation List (CRL).
required: false
type: string
type: str
cname_hostname:
description: A hostname which this alias hostname points to.
required: false
type: string
type: str
dlv_key_tag:
description: DS Key Tag
required: false
@@ -596,11 +694,11 @@ options:
dlv_digest:
description: DLV Digest
required: false
type: string
type: str
dname_target:
description: DNAME Target
required: false
type: string
type: str
ds_key_tag:
description: DS Key Tag
required: false
@@ -616,7 +714,7 @@ options:
ds_digest:
description: DS Digest
required: false
type: string
type: str
kx_preference:
description: |
Preference given to this exchanger. Lower values are more preferred.
@@ -625,7 +723,7 @@ options:
kx_exchanger:
description: A host willing to act as a key exchanger.
required: false
type: string
type: str
loc_lat_deg:
description: LOC Degrees Latitude
required: false
@@ -642,6 +740,7 @@ options:
description: LOC Direction Latitude
required: false
choices: ["N", "S"]
type: str
loc_lon_deg:
description: LOC Degrees Longitude
required: false
@@ -658,6 +757,7 @@ options:
description: LOC Direction Longitude
required: false
choices: ["E", "W"]
type: str
loc_altitude:
description: LOC Altitude
required: false
@@ -682,7 +782,7 @@ options:
mx_exchanger:
description: A host willing to act as a mail exchanger.
required: false
type: string
type: str
naptr_order:
description: NAPTR Order
required: false
@@ -694,31 +794,31 @@ options:
naptr_flags:
description: NAPTR Flags
required: false
type: string
type: str
naptr_service:
description: NAPTR Service
required: false
type: string
type: str
naptr_regexp:
description: NAPTR Regular Expression
required: false
type: string
type: str
naptr_replacement:
description: NAPTR Replacement
required: false
type: string
type: str
ns_hostname:
description: NS Hostname
required: false
type: string
type: str
ptr_hostname:
description: The hostname this reverse record points to.
required: false
type: string
type: str
srv_priority:
description: |
Lower number means higher priority. Clients will attempt to contact the
server with the lowest-numbered priority they can reach.
Lower number means higher priority. Clients will attempt to contact
the server with the lowest-numbered priority they can reach.
required: false
type: int
srv_weight:
@@ -731,26 +831,26 @@ options:
type: int
srv_target:
description: |
The domain name of the target host or '.' if the service is decidedly not
available at this domain.
The domain name of the target host or '.' if the service is decidedly
not available at this domain.
required: false
type: string
type: str
sshfp_algorithm:
description: SSHFP Algorithm
required: false
required: False
type: int
sshfp_fp_type:
description: SSHFP Fingerprint Type
required: false
required: False
type: int
sshfp_fingerprint:
description: SSHFP Fingerprint
required: false
type: string
required: False
type: str
txt_data:
description: TXT Text Data
required: false
type: string
type: str
tlsa_cert_usage:
description: TLSA Certificate Usage
required: false
@@ -766,15 +866,15 @@ options:
tlsa_cert_association_data:
description: TLSA Certificate Association Data
required: false
type: string
type: str
uri_target:
description: Target Uniform Resource Identifier according to RFC 3986.
required: false
type: string
type: str
uri_priority:
description: |
Lower number means higher priority. Clients will attempt to contact the
URI with the lowest-numbered priority they can reach.
Lower number means higher priority. Clients will attempt to contact
the URI with the lowest-numbered priority they can reach.
required: false
type: int
uri_weight:
@@ -783,11 +883,12 @@ options:
type: int
state:
description: State to ensure
type: str
default: present
choices: ["present", "absent"]
choices: ["present", "absent", "disabled"]
author:
- Rafael Guterres Jeffman
- Rafael Guterres Jeffman (@rjeffman)
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -866,8 +967,13 @@ RETURN = """
from ansible.module_utils._text import to_text
from ansible.module_utils.ansible_freeipa_module import \
IPAAnsibleModule, is_ipv4_addr, is_ipv6_addr, ipalib_errors
import dns.reversename
import dns.resolver
try:
import dns.reversename
import dns.resolver
except ImportError as _err:
MODULE_IMPORT_ERROR = str(_err)
else:
MODULE_IMPORT_ERROR = None
from ansible.module_utils import six
@@ -1015,29 +1121,49 @@ def configure_module():
"DLV", "DNAME", "DS", "KX", "LOC", "MX",
"NAPTR", "NS", "PTR", "SRV", "SSHFP", "TLSA",
"TXT", "URI"]),
record_value=dict(type='list', required=False),
record_value=dict(type='list', elements='str', required=False),
record_ttl=dict(type='int', required=False),
del_all=dict(type='bool', required=False),
a_rec=dict(type='list', required=False, aliases=['a_record']),
aaaa_rec=dict(type='list', required=False, aliases=['aaaa_record']),
a6_rec=dict(type='list', required=False, aliases=['a6_record']),
afsdb_rec=dict(type='list', required=False, aliases=['afsdb_record']),
cert_rec=dict(type='list', required=False, aliases=['cert_record']),
cname_rec=dict(type='list', required=False, aliases=['cname_record']),
dlv_rec=dict(type='list', required=False, aliases=['dlv_record']),
dname_rec=dict(type='list', required=False, aliases=['dname_record']),
ds_rec=dict(type='list', required=False, aliases=['ds_record']),
kx_rec=dict(type='list', required=False, aliases=['kx_record']),
loc_rec=dict(type='list', required=False, aliases=['loc_record']),
mx_rec=dict(type='list', required=False, aliases=['mx_record']),
naptr_rec=dict(type='list', required=False, aliases=['naptr_record']),
ns_rec=dict(type='list', required=False, aliases=['ns_record']),
ptr_rec=dict(type='list', required=False, aliases=['ptr_record']),
srv_rec=dict(type='list', required=False, aliases=['srv_record']),
sshfp_rec=dict(type='list', required=False, aliases=['sshfp_record']),
tlsa_rec=dict(type='list', required=False, aliases=['tlsa_record']),
txt_rec=dict(type='list', required=False, aliases=['txt_record']),
uri_rec=dict(type='list', required=False, aliases=['uri_record']),
a_rec=dict(type='list', elements='str', required=False,
aliases=['a_record']),
aaaa_rec=dict(type='list', elements='str', required=False,
aliases=['aaaa_record']),
a6_rec=dict(type='list', elements='str', required=False,
aliases=['a6_record']),
afsdb_rec=dict(type='list', elements='str', required=False,
aliases=['afsdb_record']),
cert_rec=dict(type='list', elements='str', required=False,
aliases=['cert_record']),
cname_rec=dict(type='list', elements='str', required=False,
aliases=['cname_record']),
dlv_rec=dict(type='list', elements='str', required=False,
aliases=['dlv_record']),
dname_rec=dict(type='list', elements='str', required=False,
aliases=['dname_record']),
ds_rec=dict(type='list', elements='str', required=False,
aliases=['ds_record']),
kx_rec=dict(type='list', elements='str', required=False,
aliases=['kx_record']),
loc_rec=dict(type='list', elements='str', required=False,
aliases=['loc_record']),
mx_rec=dict(type='list', elements='str', required=False,
aliases=['mx_record']),
naptr_rec=dict(type='list', elements='str', required=False,
aliases=['naptr_record']),
ns_rec=dict(type='list', elements='str', required=False,
aliases=['ns_record']),
ptr_rec=dict(type='list', elements='str', required=False,
aliases=['ptr_record']),
srv_rec=dict(type='list', elements='str', required=False,
aliases=['srv_record']),
sshfp_rec=dict(type='list', elements='str', required=False,
aliases=['sshfp_record']),
tlsa_rec=dict(type='list', elements='str', required=False,
aliases=['tlsa_record']),
txt_rec=dict(type='list', elements='str', required=False,
aliases=['txt_record']),
uri_rec=dict(type='list', elements='str', required=False,
aliases=['uri_record']),
ip_address=dict(type='str', required=False),
create_reverse=dict(type='bool', required=False, aliases=['reverse']),
a_ip_address=dict(type='str', required=False),
@@ -1048,16 +1174,16 @@ def configure_module():
afsdb_subtype=dict(type='int', required=False),
afsdb_hostname=dict(type='str', required=False),
cert_type=dict(type='int', required=False),
cert_key_tag=dict(type='int', required=False),
cert_key_tag=dict(type='int', required=False, no_log=True),
cert_algorithm=dict(type='int', required=False),
cert_certificate_or_crl=dict(type='str', required=False),
cname_hostname=dict(type='str', required=False),
dlv_key_tag=dict(type='int', required=False),
dlv_key_tag=dict(type='int', required=False, no_log=True),
dlv_algorithm=dict(type='int', required=False),
dlv_digest_type=dict(type='int', required=False),
dlv_digest=dict(type='str', required=False),
dname_target=dict(type='str', required=False),
ds_key_tag=dict(type='int', required=False),
ds_key_tag=dict(type='int', required=False, no_log=True),
ds_algorithm=dict(type='int', required=False),
ds_digest_type=dict(type='int', required=False),
ds_digest=dict(type='str', required=False),
@@ -1066,11 +1192,11 @@ def configure_module():
loc_lat_deg=dict(type='int', required=False),
loc_lat_min=dict(type='int', required=False),
loc_lat_sec=dict(type='float', required=False),
loc_lat_dir=dict(type='str', required=False),
loc_lat_dir=dict(type='str', required=False, choices=["N", "S"]),
loc_lon_deg=dict(type='int', required=False),
loc_lon_min=dict(type='int', required=False),
loc_lon_sec=dict(type='float', required=False),
loc_lon_dir=dict(type='str', required=False),
loc_lon_dir=dict(type='str', required=False, choices=["E", "W"]),
loc_altitude=dict(type='float', required=False),
loc_size=dict(type='float', required=False),
loc_h_precision=dict(type='float', required=False),
@@ -1105,10 +1231,14 @@ def configure_module():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["record_name"], default=None,
required=False),
name=dict(type="list", elements="str", aliases=["record_name"],
default=None, required=False),
# Use elements="str" and not elements="dict" for records:
# elements="dict" will create dicts with all unused parameters
# set to None. This breaks the module logic.
records=dict(type="list",
elements="dict",
default=None,
options=dict(
# Here name is a simple string
@@ -1131,6 +1261,9 @@ def configure_module():
ansible_module._ansible_debug = True
if MODULE_IMPORT_ERROR is not None:
ansible_module.fail_json(msg=MODULE_IMPORT_ERROR)
return ansible_module
@@ -1261,15 +1394,16 @@ def gen_args(entry):
if record_value is not None:
record_type = entry['record_type']
rec = "{}record".format(record_type.lower())
rec = "{0}record".format(record_type.lower())
args[rec] = ensure_data_is_list(record_value)
else:
for field in _RECORD_FIELDS:
record_value = entry.get(field) or entry.get("%sord" % field)
if record_value is not None:
# pylint: disable=use-maxsplit-arg
record_type = field.split('_')[0]
rec = "{}record".format(record_type.lower())
rec = "{0}record".format(record_type.lower())
args[rec] = ensure_data_is_list(record_value)
records = {
@@ -1436,6 +1570,14 @@ def main():
msg="Only one record can be added at a time.")
if records is not None:
# Remove all keys that have a None value from the dicts in records
# list.
# This is needed after setting elements="dict" for records and makes
# it behave like before with elements=None.
for record in records:
for key in list(record):
if record[key] is None:
del record[key]
names = records
# Init

View File

@@ -2,8 +2,9 @@
# Authors:
# Sergio Oliveira Campos <seocam@redhat.com>
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2020 Red Hat
# Copyright (C) 2020-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -32,16 +33,17 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipadnszone
short description: Manage FreeIPA dnszone
short_description: Manage FreeIPA dnszone
description: Manage FreeIPA dnszone
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description: The zone name string.
required: true
required: false
type: list
alises: ["zone_name"]
elements: str
aliases: ["zone_name"]
name_from_ip:
description: |
Derive zone name from reverse of IP (PTR).
@@ -51,17 +53,22 @@ options:
forwarders:
description: The list of global DNS forwarders.
required: false
options:
type: list
elements: dict
suboptions:
ip_address:
description: The forwarder nameserver IP address list (IPv4 and IPv6).
type: str
required: true
port:
description: The port to forward requests to.
type: int
required: false
forward_policy:
description:
Global forwarding policy. Set to "none" to disable any configured
global forwarders.
type: str
required: false
choices: ['only', 'first', 'none']
allow_sync_ptr:
@@ -71,6 +78,7 @@ options:
type: bool
state:
description: State to ensure
type: str
default: present
choices: ["present", "absent", "enabled", "disabled"]
name_server:
@@ -89,7 +97,7 @@ options:
description: Allow dynamic updates
required: false
type: bool
alises: ["dynamicupdate"]
aliases: ["dynamicupdate"]
dnssec:
description: Allow inline DNSSEC signing of records in the zone
required: false
@@ -97,11 +105,13 @@ options:
allow_transfer:
description: List of IP addresses or networks which are allowed to transfer the zone
required: false
type: bool
type: list
elements: str
allow_query:
description: List of IP addresses or networks which are allowed to issue queries
required: false
type: bool
type: list
elements: str
refresh:
description: SOA record refresh time
required: false
@@ -141,6 +151,9 @@ options:
description: Force DNS zone creation even if nameserver is not resolvable
required: false
type: bool
author:
- Sergio Oliveira Campos (@seocam)
- Thomas Woerner (@t-woerner)
""" # noqa: E501
EXAMPLES = """
@@ -195,13 +208,14 @@ dnszone:
description: DNS Zone dict with zone name infered from `name_from_ip`.
returned:
If `state` is `present`, `name_from_ip` is used, and a zone was created.
options:
type: dict
contains:
name:
description: The name of the zone created, inferred from `name_from_ip`.
type: str
returned: always
"""
from ipapython.dnsutil import DNSName # noqa: E402
from ansible.module_utils.ansible_freeipa_module import (
IPAAnsibleModule,
is_ip_address,
@@ -210,8 +224,9 @@ from ansible.module_utils.ansible_freeipa_module import (
ipalib_errors,
compare_args_ipa,
IPAParamMapping,
DNSName,
netaddr
) # noqa: E402
import netaddr
from ansible.module_utils import six
@@ -265,7 +280,8 @@ class DNSZoneModule(IPAAnsibleModule):
if any(invalid_ips):
self.fail_json(msg=error_msg % invalid_ips)
def is_valid_nsec3param_rec(self, nsec3param_rec): # pylint: disable=R0201
@staticmethod
def is_valid_nsec3param_rec(nsec3param_rec):
try:
part1, part2, part3, part4 = nsec3param_rec.split(" ")
except ValueError:
@@ -487,8 +503,8 @@ class DNSZoneModule(IPAAnsibleModule):
def get_argument_spec():
forwarder_spec = dict(
ip_address=dict(type=str, required=True),
port=dict(type=int, required=False, default=None),
ip_address=dict(type="str", required=True),
port=dict(type="int", required=False, default=None),
)
return dict(
@@ -500,11 +516,13 @@ def get_argument_spec():
ipaadmin_principal=dict(type="str", default="admin"),
ipaadmin_password=dict(type="str", required=False, no_log=True),
name=dict(
type="list", default=None, required=False, aliases=["zone_name"]
type="list", elements="str", default=None, required=False,
aliases=["zone_name"]
),
name_from_ip=dict(type="str", default=None, required=False),
forwarders=dict(
type="list",
elements="dict",
default=None,
required=False,
options=dict(**forwarder_spec),
@@ -526,8 +544,10 @@ def get_argument_spec():
aliases=["dynamicupdate"],
),
dnssec=dict(type="bool", required=False, default=None),
allow_transfer=dict(type="list", required=False, default=None),
allow_query=dict(type="list", required=False, default=None),
allow_transfer=dict(type="list", elements="str", required=False,
default=None),
allow_query=dict(type="list", elements="str", required=False,
default=None),
refresh=dict(type="int", required=False, default=None),
retry=dict(type="int", required=False, default=None),
expire=dict(type="int", required=False, default=None),

View File

@@ -3,7 +3,7 @@
# Authors:
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2019 Red Hat
# Copyright (C) 2019-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -32,20 +32,104 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipagroup
short description: Manage FreeIPA groups
short_description: Manage FreeIPA groups
description: Manage FreeIPA groups
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description: The group name
type: list
elements: str
required: false
aliases: ["cn"]
groups:
description: The list of group dicts (internally gid).
type: list
elements: dict
suboptions:
name:
description: The group (internally gid).
type: str
required: true
aliases: ["cn"]
description:
description: The group description
type: str
required: false
gid:
description: The GID
type: int
required: false
aliases: ["gidnumber"]
nonposix:
description: Create as a non-POSIX group
required: false
type: bool
external:
description: Allow adding external non-IPA members from trusted domains
required: false
type: bool
posix:
description:
Create a non-POSIX group or change a non-POSIX to a posix group.
required: false
type: bool
nomembers:
description: Suppress processing of membership attributes
required: false
type: bool
user:
description: List of user names assigned to this group.
required: false
type: list
elements: str
group:
description: List of group names assigned to this group.
required: false
type: list
elements: str
service:
description:
- List of service names assigned to this group.
- Only usable with IPA versions 4.7 and up.
required: false
type: list
elements: str
membermanager_user:
description:
- List of member manager users assigned to this group.
- Only usable with IPA versions 4.8.4 and up.
required: false
type: list
elements: str
membermanager_group:
description:
- List of member manager groups assigned to this group.
- Only usable with IPA versions 4.8.4 and up.
required: false
type: list
elements: str
externalmember:
description:
- List of members of a trusted domain in DOM\\name or name@domain form.
required: false
type: list
elements: str
aliases: ["ipaexternalmember", "external_member"]
idoverrideuser:
description:
- User ID overrides to add
required: false
type: list
elements: str
description:
description: The group description
type: str
required: false
gid:
description: The GID
type: int
required: false
aliases: ["gidnumber"]
nonposix:
@@ -69,49 +153,58 @@ options:
description: List of user names assigned to this group.
required: false
type: list
elements: str
group:
description: List of group names assigned to this group.
required: false
type: list
elements: str
service:
description:
- List of service names assigned to this group.
- Only usable with IPA versions 4.7 and up.
required: false
type: list
elements: str
membermanager_user:
description:
- List of member manager users assigned to this group.
- Only usable with IPA versions 4.8.4 and up.
required: false
type: list
elements: str
membermanager_group:
description:
- List of member manager groups assigned to this group.
- Only usable with IPA versions 4.8.4 and up.
required: false
type: list
elements: str
externalmember:
description:
- List of members of a trusted domain in DOM\\name or name@domain form.
required: false
type: list
ailases: ["ipaexternalmember", "external_member"]
elements: str
aliases: ["ipaexternalmember", "external_member"]
idoverrideuser:
description:
- User ID overrides to add
required: false
type: list
elements: str
action:
description: Work on group or member level
type: str
default: group
choices: ["member", "group"]
state:
description: State to ensure
type: str
default: present
choices: ["present", "absent"]
author:
- Thomas Woerner
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -131,6 +224,14 @@ EXAMPLES = """
ipaadmin_password: SomeADMINpassword
name: appops
# Create multiple groups ops, sysops
- ipagroup:
ipaadmin_password: SomeADMINpassword
groups:
- name: ops
gidnumber: 1234
- name: sysops
# Add user member pinky to group sysops
- ipagroup:
ipaadmin_password: SomeADMINpassword
@@ -147,7 +248,7 @@ EXAMPLES = """
user:
- brain
# Add group members sysops and appops to group sysops
# Add group members sysops and appops to group ops
- ipagroup:
ipaadmin_password: SomeADMINpassword
name: ops
@@ -155,6 +256,17 @@ EXAMPLES = """
- sysops
- appops
# Add user and group members to groups sysops and appops
- ipagroup:
ipaadmin_password: SomeADMINpassword
groups:
- name: sysops
user:
- user1
- name: appops
group:
- group2
# Create a non-POSIX group
- ipagroup:
ipaadmin_password: SomeADMINpassword
@@ -176,7 +288,16 @@ EXAMPLES = """
- WINIPA\\Web Users
- WINIPA\\Developers
# Remove goups sysops, appops, ops and nongroup
# Create multiple non-POSIX and external groups
- ipagroup:
ipaadmin_password: SomeADMINpassword
groups:
- name: nongroup
nonposix: true
- name: extgroup
external: true
# Remove groups sysops, appops, ops and nongroup
- ipagroup:
ipaadmin_password: SomeADMINpassword
name: sysops,appops,ops, nongroup
@@ -190,6 +311,20 @@ from ansible.module_utils._text import to_text
from ansible.module_utils.ansible_freeipa_module import \
IPAAnsibleModule, compare_args_ipa, gen_add_del_lists, \
gen_add_list, gen_intersection_list, api_check_param
from ansible.module_utils import six
if six.PY3:
unicode = str
# Ensuring (adding) several groups with mixed types external, nonposix
# and posix require to have a fix in IPA:
# FreeIPA issue: https://pagure.io/freeipa/issue/9349
# FreeIPA fix: https://github.com/freeipa/freeipa/pull/6741
try:
from ipaserver.plugins import baseldap
except ImportError:
FIX_6741_DEEPCOPY_OBJECTCLASSES = False
else:
FIX_6741_DEEPCOPY_OBJECTCLASSES = \
"deepcopy" in baseldap.LDAPObject.__json__.__code__.co_names
def find_group(module, name):
@@ -244,6 +379,22 @@ def gen_member_args(user, group, service, externalmember, idoverrideuser):
return _args
def check_parameters(module, state, action):
invalid = []
if state == "present":
if action == "member":
invalid = ["description", "gid", "posix", "nonposix", "external",
"nomembers"]
else:
invalid = ["description", "gid", "posix", "nonposix", "external",
"nomembers"]
if action == "group":
invalid.extend(["user", "group", "service", "externalmember"])
module.params_fail_used_invalid(invalid, state, action)
def is_external_group(res_find):
"""Verify if the result group is an external group."""
return res_find and 'ipaexternalgroup' in res_find['objectclass']
@@ -272,39 +423,63 @@ def check_objectclass_args(module, res_find, posix, external):
def main():
group_spec = dict(
# present
description=dict(type="str", default=None),
gid=dict(type="int", aliases=["gidnumber"], default=None),
nonposix=dict(required=False, type='bool', default=None),
external=dict(required=False, type='bool', default=None),
posix=dict(required=False, type='bool', default=None),
nomembers=dict(required=False, type='bool', default=None),
user=dict(required=False, type='list', elements="str",
default=None),
group=dict(required=False, type='list', elements="str",
default=None),
service=dict(required=False, type='list', elements="str",
default=None),
idoverrideuser=dict(required=False, type='list', elements="str",
default=None),
membermanager_user=dict(required=False, type='list',
elements="str", default=None),
membermanager_group=dict(required=False, type='list',
elements="str", default=None),
externalmember=dict(required=False, type='list', elements="str",
default=None,
aliases=[
"ipaexternalmember",
"external_member"
])
)
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["cn"], default=None,
required=True),
# present
description=dict(type="str", default=None),
gid=dict(type="int", aliases=["gidnumber"], default=None),
nonposix=dict(required=False, type='bool', default=None),
external=dict(required=False, type='bool', default=None),
posix=dict(required=False, type='bool', default=None),
nomembers=dict(required=False, type='bool', default=None),
user=dict(required=False, type='list', default=None),
group=dict(required=False, type='list', default=None),
service=dict(required=False, type='list', default=None),
idoverrideuser=dict(required=False, type='list', default=None),
membermanager_user=dict(required=False, type='list', default=None),
membermanager_group=dict(required=False, type='list',
default=None),
externalmember=dict(required=False, type='list', default=None,
aliases=[
"ipaexternalmember",
"external_member"
]),
name=dict(type="list", elements="str", aliases=["cn"],
default=None, required=False),
groups=dict(type="list",
default=None,
options=dict(
# Here name is a simple string
name=dict(type="str", required=True,
aliases=["cn"]),
# Add group specific parameters
**group_spec
),
elements='dict',
required=False),
# general
action=dict(type="str", default="group",
choices=["member", "group"]),
# state
state=dict(type="str", default="present",
choices=["present", "absent"]),
# Add group specific parameters for simple use case
**group_spec
),
# It does not make sense to set posix, nonposix or external at the
# same time
mutually_exclusive=[['posix', 'nonposix', 'external']],
mutually_exclusive=[['posix', 'nonposix', 'external'],
["name", "groups"]],
required_one_of=[["name", "groups"]],
supports_check_mode=True,
)
@@ -314,6 +489,7 @@ def main():
# general
names = ansible_module.params_get("name")
groups = ansible_module.params_get("groups")
# present
description = ansible_module.params_get("description")
@@ -335,31 +511,50 @@ def main():
state = ansible_module.params_get("state")
# Check parameters
invalid = []
if (names is None or len(names) < 1) and \
(groups is None or len(groups) < 1):
ansible_module.fail_json(msg="At least one name or groups is required")
if state == "present":
if len(names) != 1:
if names is not None and len(names) != 1:
ansible_module.fail_json(
msg="Only one group can be added at a time.")
if action == "member":
invalid = ["description", "gid", "posix", "nonposix", "external",
"nomembers"]
msg="Only one group can be added at a time using 'name'.")
if state == "absent":
if len(names) < 1:
ansible_module.fail_json(
msg="No name given.")
invalid = ["description", "gid", "posix", "nonposix", "external",
"nomembers"]
if action == "group":
invalid.extend(["user", "group", "service", "externalmember"])
ansible_module.params_fail_used_invalid(invalid, state, action)
check_parameters(ansible_module, state, action)
if external is False:
ansible_module.fail_json(
msg="group can not be non-external")
# Ensuring (adding) several groups with mixed types external, nonposix
# and posix require to have a fix in IPA:
#
# FreeIPA issue: https://pagure.io/freeipa/issue/9349
# FreeIPA fix: https://github.com/freeipa/freeipa/pull/6741
#
# The simple solution is to switch to client context for ensuring
# several groups simply if the user was not explicitly asking for
# the server context no matter if mixed types are used.
context = None
if state == "present" and groups is not None and len(groups) > 1 \
and not FIX_6741_DEEPCOPY_OBJECTCLASSES:
_context = ansible_module.params_get("ipaapi_context")
if _context is None:
context = "client"
ansible_module.debug(
"Switching to client context due to an unfixed issue in "
"your IPA version: https://pagure.io/freeipa/issue/9349")
elif _context == "server":
ansible_module.fail_json(
msg="Ensuring several groups with server context is not "
"supported by your IPA version: "
"https://pagure.io/freeipa/issue/9349")
# Use groups if names is None
if groups is not None:
names = groups
# Init
changed = False
@@ -370,7 +565,7 @@ def main():
posix = not nonposix
# Connect to IPA API
with ansible_module.ipa_connect():
with ansible_module.ipa_connect(context=context):
has_add_member_service = ansible_module.ipa_command_param_exists(
"group_add_member", "service")
@@ -396,8 +591,57 @@ def main():
"supported by your IPA version")
commands = []
group_set = set()
for group_name in names:
if isinstance(group_name, dict):
name = group_name.get("name")
if name in group_set:
ansible_module.fail_json(
msg="group '%s' is used more than once" % name)
group_set.add(name)
# present
description = group_name.get("description")
gid = group_name.get("gid")
nonposix = group_name.get("nonposix")
external = group_name.get("external")
idoverrideuser = group_name.get("idoverrideuser")
posix = group_name.get("posix")
# Check mutually exclusive condition for multiple groups
# creation. It's not possible to check it with
# `mutually_exclusive` argument in `IPAAnsibleModule` class
# because it accepts only (list[str] or list[list[str]]). Here
# we need to loop over all groups and fail on mutually
# exclusive ones.
if all((posix, nonposix)) or\
all((posix, external)) or\
all((nonposix, external)):
ansible_module.fail_json(
msg="parameters are mutually exclusive for group "
"`{0}`: posix|nonposix|external".format(name))
# Duplicating the condition for multiple group creation
if external is False:
ansible_module.fail_json(
msg="group can not be non-external")
# If nonposix is used, set posix as not nonposix
if nonposix is not None:
posix = not nonposix
user = group_name.get("user")
group = group_name.get("group")
service = group_name.get("service")
membermanager_user = group_name.get("membermanager_user")
membermanager_group = group_name.get("membermanager_group")
externalmember = group_name.get("externalmember")
nomembers = group_name.get("nomembers")
check_parameters(ansible_module, state, action)
elif isinstance(group_name, (str, unicode)):
name = group_name
else:
ansible_module.fail_json(msg="Group '%s' is not valid" %
repr(group_name))
for name in names:
# Make sure group exists
res_find = find_group(ansible_module, name)
@@ -574,10 +818,12 @@ def main():
del_member_args["service"] = service_del
if is_external_group(res_find):
add_member_args["ipaexternalmember"] = \
externalmember_add
del_member_args["ipaexternalmember"] = \
externalmember_del
if len(externalmember_add) > 0:
add_member_args["ipaexternalmember"] = \
externalmember_add
if len(externalmember_del) > 0:
del_member_args["ipaexternalmember"] = \
externalmember_del
elif externalmember or external:
ansible_module.fail_json(
msg="Cannot add external members to a "

View File

@@ -3,7 +3,7 @@
# Authors:
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2019 Red Hat
# Copyright (C) 2019-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -32,30 +32,36 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipahbacrule
short description: Manage FreeIPA HBAC rules
short_description: Manage FreeIPA HBAC rules
description: Manage FreeIPA HBAC rules
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description: The hbacrule name
type: list
elements: str
required: true
aliases: ["cn"]
description:
description: The hbacrule description
type: str
required: false
usercategory:
description: User category the rule applies to
type: str
required: false
aliases: ["usercat"]
choices: ["all", ""]
hostcategory:
description: Host category the rule applies to
type: str
required: false
aliases: ["hostcat"]
choices: ["all", ""]
servicecategory:
description: Service category the rule applies to
type: str
required: false
aliases: ["servicecat"]
choices: ["all", ""]
@@ -67,36 +73,44 @@ options:
description: List of host names assigned to this hbacrule.
required: false
type: list
elements: str
hostgroup:
description: List of host groups assigned to this hbacrule.
required: false
type: list
elements: str
hbacsvc:
description: List of HBAC service names assigned to this hbacrule.
required: false
type: list
elements: str
hbacsvcgroup:
description: List of HBAC service names assigned to this hbacrule.
required: false
type: list
elements: str
user:
description: List of user names assigned to this hbacrule.
required: false
type: list
elements: str
group:
description: List of user groups assigned to this hbacrule.
required: false
type: list
elements: str
action:
description: Work on hbacrule or member level
type: str
default: hbacrule
choices: ["member", "hbacrule"]
state:
description: State to ensure
type: str
default: present
choices: ["present", "absent", "enabled", "disabled"]
author:
- Thomas Woerner
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -198,7 +212,7 @@ def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["cn"], default=None,
name=dict(type="list", elements="str", aliases=["cn"],
required=True),
# present
description=dict(type="str", default=None),
@@ -209,12 +223,18 @@ def main():
servicecategory=dict(type="str", default=None,
aliases=["servicecat"], choices=["all", ""]),
nomembers=dict(required=False, type='bool', default=None),
host=dict(required=False, type='list', default=None),
hostgroup=dict(required=False, type='list', default=None),
hbacsvc=dict(required=False, type='list', default=None),
hbacsvcgroup=dict(required=False, type='list', default=None),
user=dict(required=False, type='list', default=None),
group=dict(required=False, type='list', default=None),
host=dict(required=False, type='list', elements="str",
default=None),
hostgroup=dict(required=False, type='list', elements="str",
default=None),
hbacsvc=dict(required=False, type='list', elements="str",
default=None),
hbacsvcgroup=dict(required=False, type='list', elements="str",
default=None),
user=dict(required=False, type='list', elements="str",
default=None),
group=dict(required=False, type='list', elements="str",
default=None),
action=dict(type="str", default="hbacrule",
choices=["member", "hbacrule"]),
# state

View File

@@ -3,7 +3,7 @@
# Authors:
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2019 Red Hat
# Copyright (C) 2019-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -32,24 +32,28 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipahbacsvc
short description: Manage FreeIPA HBAC Services
short_description: Manage FreeIPA HBAC Services
description: Manage FreeIPA HBAC Services
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description: The group name
required: false
type: list
elements: str
required: true
aliases: ["cn", "service"]
description:
description: The HBAC Service description
type: str
required: false
state:
description: State to ensure
type: str
default: present
choices: ["present", "absent"]
author:
- Thomas Woerner
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -102,7 +106,7 @@ def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["cn", "service"], default=None,
name=dict(type="list", elements="str", aliases=["cn", "service"],
required=True),
# present

View File

@@ -3,7 +3,7 @@
# Authors:
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2019 Red Hat
# Copyright (C) 2019-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -33,36 +33,42 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipahbacsvcgroup
short description: Manage FreeIPA hbacsvcgroups
short_description: Manage FreeIPA hbacsvcgroups
description: Manage FreeIPA hbacsvcgroups
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description: The hbacsvcgroup name
required: false
type: list
elements: str
required: true
aliases: ["cn"]
description:
description: The hbacsvcgroup description
type: str
required: false
hbacsvc:
description: List of hbacsvc names assigned to this hbacsvcgroup.
required: false
type: list
elements: str
nomembers:
description: Suppress processing of membership attributes
required: false
type: bool
action:
description: Work on hbacsvcgroup or member level
type: str
default: hbacsvcgroup
choices: ["member", "hbacsvcgroup"]
state:
description: State to ensure
type: str
default: present
choices: ["present", "absent"]
author:
- Thomas Woerner
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -159,12 +165,13 @@ def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["cn"], default=None,
name=dict(type="list", elements="str", aliases=["cn"],
required=True),
# present
description=dict(type="str", default=None),
nomembers=dict(required=False, type='bool', default=None),
hbacsvc=dict(required=False, type='list', default=None),
hbacsvc=dict(required=False, type='list', elements="str",
default=None),
action=dict(type="str", default="hbacsvcgroup",
choices=["member", "hbacsvcgroup"]),
# state

View File

@@ -3,7 +3,7 @@
# Authors:
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2019 Red Hat
# Copyright (C) 2019-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -32,122 +32,157 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipahost
short description: Manage FreeIPA hosts
short_description: Manage FreeIPA hosts
description: Manage FreeIPA hosts
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description: The full qualified domain name.
type: list
elements: str
aliases: ["fqdn"]
required: true
hosts:
description: The list of user host dicts
required: false
options:
hosts:
description: The list of host dicts
required: false
type: list
elements: dict
suboptions:
name:
description: The host (internally uid).
type: str
aliases: ["fqdn"]
required: true
description:
description: The host description
type: str
required: false
locality:
description: Host locality (e.g. "Baltimore, MD")
type: str
required: false
location:
description: Host location (e.g. "Lab 2")
type: str
aliases: ["ns_host_location"]
required: false
platform:
description: Host hardware platform (e.g. "Lenovo T61")
type: str
aliases: ["ns_hardware_platform"]
required: false
os:
description: Host operating system and version (e.g. "Fedora 9")
type: str
aliases: ["ns_os_version"]
required: false
password:
description: Password used in bulk enrollment
type: str
aliases: ["user_password", "userpassword"]
required: false
random:
description:
Initiate the generation of a random password to be used in bulk
enrollment
type: bool
aliases: ["random_password"]
required: false
certificate:
description: List of base-64 encoded host certificates
type: list
elements: str
aliases: ["usercertificate"]
required: false
managedby_host:
description: List of hosts that can manage this host
type: list
aliases: ["principalname", "krbprincipalname"]
elements: str
required: false
principal:
description: List of principal aliases for this host
type: list
elements: str
aliases: ["principalname", "krbprincipalname"]
required: false
allow_create_keytab_user:
description: Users allowed to create a keytab of this host
type: list
elements: str
aliases: ["ipaallowedtoperform_write_keys_user"]
required: false
allow_create_keytab_group:
description: Groups allowed to create a keytab of this host
type: list
elements: str
aliases: ["ipaallowedtoperform_write_keys_group"]
required: false
allow_create_keytab_host:
description: Hosts allowed to create a keytab of this host
type: list
elements: str
aliases: ["ipaallowedtoperform_write_keys_host"]
required: false
allow_create_keytab_hostgroup:
description: Hostgroups allowed to create a keytab of this host
type: list
elements: str
aliases: ["ipaallowedtoperform_write_keys_hostgroup"]
required: false
allow_retrieve_keytab_user:
description: Users allowed to retrieve a keytab of this host
type: list
elements: str
aliases: ["ipaallowedtoperform_read_keys_user"]
required: false
allow_retrieve_keytab_group:
description: Groups allowed to retrieve a keytab of this host
type: list
elements: str
aliases: ["ipaallowedtoperform_read_keys_group"]
required: false
allow_retrieve_keytab_host:
description: Hosts allowed to retrieve a keytab of this host
type: list
elements: str
aliases: ["ipaallowedtoperform_read_keys_host"]
required: false
allow_retrieve_keytab_hostgroup:
description: Hostgroups allowed to retrieve a keytab of this host
type: list
elements: str
aliases: ["ipaallowedtoperform_read_keys_hostgroup"]
required: false
mac_address:
description: List of hardware MAC addresses.
type: list
elements: str
aliases: ["macaddress"]
required: false
sshpubkey:
description: List of SSH public keys
type: list
elements: str
aliases: ["ipasshpubkey"]
required: false
userclass:
description:
Host category (semantics placed on this attribute are for local
interpretation)
type: list
elements: str
aliases: ["class"]
required: false
auth_ind:
description:
Defines a whitelist for Authentication Indicators. Use 'otp' to allow
OTP-based 2FA authentications. Use 'radius' to allow RADIUS-based 2FA
authentications. Other values may be used for custom configurations.
Use empty string to reset auth_ind to the initial value.
Defines an allow list for Authentication Indicators. Use 'otp'
to allow OTP-based 2FA authentications. Use 'radius' to allow
RADIUS-based 2FA authentications. Other values may be used
for custom configurations. Use empty string to reset auth_ind
to the initial value.
type: list
elements: str
aliases: ["krbprincipalauthind"]
choices: ["radius", "otp", "pkinit", "hardened", ""]
required: false
@@ -169,15 +204,18 @@ options:
required: false
force:
description: Force host name even if not in DNS
type: bool
required: false
reverse:
description: Reverse DNS detection
default: true
type: bool
required: false
ip_address:
description:
The host IP address list (IPv4 and IPv6). No IP address conflict
check will be done.
type: list
elements: str
aliases: ["ipaddress"]
required: false
update_dns:
@@ -185,105 +223,138 @@ options:
Controls the update of the DNS SSHFP records for existing hosts and
the removal of all DNS entries if a host gets removed with state
absent.
type: bool
aliases: ["updatedns"]
required: false
description:
description: The host description
type: str
required: false
locality:
description: Host locality (e.g. "Baltimore, MD")
type: str
required: false
location:
description: Host location (e.g. "Lab 2")
type: str
aliases: ["ns_host_location"]
required: false
platform:
description: Host hardware platform (e.g. "Lenovo T61")
type: str
aliases: ["ns_hardware_platform"]
required: false
os:
description: Host operating system and version (e.g. "Fedora 9")
type: str
aliases: ["ns_os_version"]
required: false
password:
description: Password used in bulk enrollment
type: str
aliases: ["user_password", "userpassword"]
required: false
random:
description:
Initiate the generation of a random password to be used in bulk
enrollment
type: bool
aliases: ["random_password"]
required: false
certificate:
description: List of base-64 encoded host certificates
type: list
elements: str
aliases: ["usercertificate"]
required: false
managedby_host:
description: List of hosts that can manage this host
type: list
aliases: ["principalname", "krbprincipalname"]
elements: str
required: false
principal:
description: List of principal aliases for this host
type: list
elements: str
aliases: ["principalname", "krbprincipalname"]
required: false
allow_create_keytab_user:
description: Users allowed to create a keytab of this host
type: list
elements: str
aliases: ["ipaallowedtoperform_write_keys_user"]
required: false
allow_create_keytab_group:
description: Groups allowed to create a keytab of this host
type: list
elements: str
aliases: ["ipaallowedtoperform_write_keys_group"]
required: false
allow_create_keytab_host:
description: Hosts allowed to create a keytab of this host
type: list
elements: str
aliases: ["ipaallowedtoperform_write_keys_host"]
required: false
allow_create_keytab_hostgroup:
description: Hostgroups allowed to create a keytab of this host
type: list
elements: str
aliases: ["ipaallowedtoperform_write_keys_hostgroup"]
required: false
allow_retrieve_keytab_user:
description: Users allowed to retrieve a keytab of this host
type: list
elements: str
aliases: ["ipaallowedtoperform_read_keys_user"]
required: false
allow_retrieve_keytab_group:
description: Groups allowed to retrieve a keytab of this host
type: list
elements: str
aliases: ["ipaallowedtoperform_read_keys_group"]
required: false
allow_retrieve_keytab_host:
description: Hosts allowed to retrieve a keytab of this host
type: list
elements: str
aliases: ["ipaallowedtoperform_read_keys_host"]
required: false
allow_retrieve_keytab_hostgroup:
description: Hostgroups allowed to retrieve a keytab of this host
type: list
elements: str
aliases: ["ipaallowedtoperform_read_keys_hostgroup"]
required: false
mac_address:
description: List of hardware MAC addresses.
type: list
elements: str
aliases: ["macaddress"]
required: false
sshpubkey:
description: List of SSH public keys
type: list
elements: str
aliases: ["ipasshpubkey"]
required: false
userclass:
description:
Host category (semantics placed on this attribute are for local
interpretation)
type: list
elements: str
aliases: ["class"]
required: false
auth_ind:
description:
Defines a whitelist for Authentication Indicators. Use 'otp' to allow
OTP-based 2FA authentications. Use 'radius' to allow RADIUS-based 2FA
authentications. Other values may be used for custom configurations.
Use empty string to reset auth_ind to the initial value.
Defines an allow list for Authentication Indicators. Use 'otp'
to allow OTP-based 2FA authentications. Use 'radius' to allow
RADIUS-based 2FA authentications. Other values may be used
for custom configurations. Use empty string to reset auth_ind
to the initial value.
type: list
elements: str
aliases: ["krbprincipalauthind"]
choices: ["radius", "otp", "pkinit", "hardened", ""]
required: false
@@ -298,21 +369,25 @@ options:
aliases: ["ipakrbokasdelegate"]
required: false
ok_to_auth_as_delegate:
description: The service is allowed to authenticate on behalf of a client
description:
The service is allowed to authenticate on behalf of a client
type: bool
aliases: ["ipakrboktoauthasdelegate"]
required: false
force:
description: Force host name even if not in DNS
type: bool
required: false
reverse:
description: Reverse DNS detection
default: true
type: bool
required: false
ip_address:
description:
The host IP address list (IPv4 and IPv6). No IP address conflict
check will be done.
type: list
elements: str
aliases: ["ipaddress"]
required: false
update_dns:
@@ -320,23 +395,27 @@ options:
Controls the update of the DNS SSHFP records for existing hosts and
the removal of all DNS entries if a host gets removed with state
absent.
type: bool
aliases: ["updatedns"]
required: false
update_password:
description:
Set password for a host in present state only on creation or always
default: 'always'
type: str
choices: ["always", "on_create"]
action:
description: Work on host or member level
type: str
default: "host"
choices: ["member", "host"]
state:
description: State to ensure
type: str
default: present
choices: ["present", "absent",
"disabled"]
author:
- Thomas Woerner
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -362,6 +441,15 @@ EXAMPLES = """
description: Example host
force: yes
# Ensure multiple hosts are present with random passwords
- ipahost:
ipaadmin_password: SomeADMINpassword
hosts:
- name: host01.example.com
random: yes
- name: host02.example.com
random: yes
# Initiate generation of a random password for the host
- ipahost:
ipaadmin_password: SomeADMINpassword
@@ -370,6 +458,18 @@ EXAMPLES = """
ip_address: 192.168.0.123
random: yes
# Ensure multiple hosts are present with principals
- ipahost:
ipaadmin_password: SomeADMINpassword
hosts:
- name: host01.example.com
principal:
- host/testhost01.example.com
- name: host02.example.com
principal:
- host/myhost01.example.com
action: member
# Ensure host is disabled
- ipahost:
ipaadmin_password: SomeADMINpassword
@@ -387,19 +487,23 @@ EXAMPLES = """
RETURN = """
host:
description: Host dict with random password
returned: If random is yes and user did not exist or update_password is yes
returned: If random is yes and host did not exist or update_password is yes
type: dict
options:
contains:
randompassword:
description: The generated random password
returned: If only one user is handled by the module
type: str
returned: |
If only one host is handled by the module without using hosts parameter
name:
description: The user name of the user that got a new random password
returned: If several users are handled by the module
description: The host name of the host that got a new random password
returned: |
If several hosts are handled by the module with the hosts parameter
type: dict
options:
contains:
randompassword:
description: The generated random password
type: str
returned: always
"""
@@ -565,10 +669,10 @@ def check_parameters( # pylint: disable=unused-argument
# pylint: disable=unused-argument
def result_handler(module, result, command, name, args, errors, exit_args,
one_name):
single_host):
if "random" in args and command in ["host_add", "host_mod"] \
and "randompassword" in result["result"]:
if one_name:
if single_host:
exit_args["randompassword"] = \
result["result"]["randompassword"]
else:
@@ -590,7 +694,7 @@ def result_handler(module, result, command, name, args, errors, exit_args,
# pylint: disable=unused-argument
def exception_handler(module, ex, errors, exit_args, one_name):
def exception_handler(module, ex, errors, exit_args, single_host):
msg = str(ex)
if "already contains" in msg \
or "does not contain" in msg:
@@ -626,52 +730,52 @@ def main():
default=None, no_log=True),
random=dict(type="bool", aliases=["random_password"],
default=None),
certificate=dict(type="list", aliases=["usercertificate"],
default=None),
managedby_host=dict(type="list",
default=None),
principal=dict(type="list", aliases=["krbprincipalname"],
certificate=dict(type="list", elements="str",
aliases=["usercertificate"], default=None),
managedby_host=dict(type="list", elements="str", default=None),
principal=dict(type="list", elements="str",
aliases=["principalname", "krbprincipalname"],
default=None),
allow_create_keytab_user=dict(
type="list",
type="list", elements="str",
aliases=["ipaallowedtoperform_write_keys_user"],
default=None),
default=None, no_log=False),
allow_create_keytab_group=dict(
type="list",
type="list", elements="str",
aliases=["ipaallowedtoperform_write_keys_group"],
default=None),
default=None, no_log=False),
allow_create_keytab_host=dict(
type="list",
type="list", elements="str",
aliases=["ipaallowedtoperform_write_keys_host"],
default=None),
default=None, no_log=False),
allow_create_keytab_hostgroup=dict(
type="list",
type="list", elements="str",
aliases=["ipaallowedtoperform_write_keys_hostgroup"],
default=None),
default=None, no_log=False),
allow_retrieve_keytab_user=dict(
type="list",
aliases=["ipaallowedtoperform_write_keys_user"],
default=None),
type="list", elements="str",
aliases=["ipaallowedtoperform_read_keys_user"],
default=None, no_log=False),
allow_retrieve_keytab_group=dict(
type="list",
aliases=["ipaallowedtoperform_write_keys_group"],
default=None),
type="list", elements="str",
aliases=["ipaallowedtoperform_read_keys_group"],
default=None, no_log=False),
allow_retrieve_keytab_host=dict(
type="list",
aliases=["ipaallowedtoperform_write_keys_host"],
default=None),
type="list", elements="str",
aliases=["ipaallowedtoperform_read_keys_host"],
default=None, no_log=False),
allow_retrieve_keytab_hostgroup=dict(
type="list",
aliases=["ipaallowedtoperform_write_keys_hostgroup"],
default=None),
mac_address=dict(type="list", aliases=["macaddress"],
type="list", elements="str",
aliases=["ipaallowedtoperform_read_keys_hostgroup"],
default=None, no_log=False),
mac_address=dict(type="list", elements="str", aliases=["macaddress"],
default=None),
sshpubkey=dict(type="str", aliases=["ipasshpubkey"],
sshpubkey=dict(type="list", elements="str", aliases=["ipasshpubkey"],
default=None),
userclass=dict(type="list", aliases=["class"],
userclass=dict(type="list", elements="str", aliases=["class"],
default=None),
auth_ind=dict(type='list', aliases=["krbprincipalauthind"],
default=None,
auth_ind=dict(type='list', elements="str",
aliases=["krbprincipalauthind"], default=None,
choices=['radius', 'otp', 'pkinit', 'hardened', '']),
requires_pre_auth=dict(type="bool", aliases=["ipakrbrequirespreauth"],
default=None),
@@ -682,7 +786,7 @@ def main():
default=None),
force=dict(type='bool', default=None),
reverse=dict(type='bool', default=None),
ip_address=dict(type="list", aliases=["ipaddress"],
ip_address=dict(type="list", elements="str", aliases=["ipaddress"],
default=None),
update_dns=dict(type="bool", aliases=["updatedns"],
default=None),
@@ -695,8 +799,8 @@ def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["fqdn"], default=None,
required=False),
name=dict(type="list", elements="str", aliases=["fqdn"],
default=None, required=False),
hosts=dict(type="list", default=None,
options=dict(
@@ -762,7 +866,8 @@ def main():
allow_retrieve_keytab_hostgroup = ansible_module.params_get(
"allow_retrieve_keytab_hostgroup")
mac_address = ansible_module.params_get("mac_address")
sshpubkey = ansible_module.params_get("sshpubkey")
sshpubkey = ansible_module.params_get("sshpubkey",
allow_empty_string=True)
userclass = ansible_module.params_get("userclass")
auth_ind = ansible_module.params_get("auth_ind", allow_empty_string=True)
requires_pre_auth = ansible_module.params_get("requires_pre_auth")
@@ -1386,7 +1491,7 @@ def main():
changed = ansible_module.execute_ipa_commands(
commands, result_handler, exception_handler,
exit_args=exit_args, one_name=len(names) == 1)
exit_args=exit_args, single_host=hosts is None)
# Done

View File

@@ -3,7 +3,7 @@
# Authors:
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2019 Red Hat
# Copyright (C) 2019-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -33,17 +33,20 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipahostgroup
short description: Manage FreeIPA hostgroups
short_description: Manage FreeIPA hostgroups
description: Manage FreeIPA hostgroups
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description: The hostgroup name
required: false
type: list
elements: str
required: true
aliases: ["cn"]
description:
description: The hostgroup description
type: str
required: false
nomembers:
description: Suppress processing of membership attributes
@@ -53,38 +56,45 @@ options:
description: List of host names assigned to this hostgroup.
required: false
type: list
elements: str
hostgroup:
description: List of hostgroup names assigned to this hostgroup.
required: false
type: list
elements: str
membermanager_user:
description:
- List of member manager users assigned to this hostgroup.
- Only usable with IPA versions 4.8.4 and up.
required: false
type: list
elements: str
membermanager_group:
description:
- List of member manager groups assigned to this hostgroup.
- Only usable with IPA versions 4.8.4 and up.
required: false
type: list
elements: str
rename:
description:
- Rename hostgroup to the given name.
- Only usable with IPA versions 4.8.7 and up.
type: str
required: false
aliases: ["new_name"]
action:
description: Work on hostgroup or member level
type: str
default: hostgroup
choices: ["member", "hostgroup"]
state:
description: State to ensure
type: str
default: present
choices: ["present", "absent", "renamed"]
author:
- Thomas Woerner
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -185,16 +195,19 @@ def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["cn"], default=None,
name=dict(type="list", elements="str", aliases=["cn"],
required=True),
# present
description=dict(type="str", default=None),
nomembers=dict(required=False, type='bool', default=None),
host=dict(required=False, type='list', default=None),
hostgroup=dict(required=False, type='list', default=None),
membermanager_user=dict(required=False, type='list', default=None),
host=dict(required=False, type='list', elements="str",
default=None),
hostgroup=dict(required=False, type='list', elements="str",
default=None),
membermanager_user=dict(required=False, type='list',
elements="str", default=None),
membermanager_group=dict(required=False, type='list',
default=None),
elements="str", default=None),
rename=dict(required=False, type='str', default=None,
aliases=["new_name"]),
action=dict(type="str", default="hostgroup",

View File

@@ -2,6 +2,7 @@
# Authors:
# Rafael Guterres Jeffman <rjeffman@redhat.com>
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2022 Red Hat
# see file 'COPYING' for use and warranty information
@@ -32,7 +33,7 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipaidrange
short description: Manage FreeIPA idrange
short_description: Manage FreeIPA idrange
description: Manage FreeIPA idrange
extends_documentation_fragment:
- ipamodule_base_docs
@@ -40,6 +41,8 @@ extends_documentation_fragment:
options:
name:
description: The list of idrange name strings.
type: list
elements: str
required: true
aliases: ["cn"]
base_id:
@@ -64,33 +67,37 @@ options:
aliases: ["ipasecondarybaserid"]
idrange_type:
description: ID range type.
type: string
type: str
required: false
choices: ["ipa-ad-trust", "ipa-ad-trust-posix", "ipa-local"]
aliases: ["iparangetype"]
dom_sid:
description: Domain SID of the trusted domain.
type: string
type: str
required: false
aliases: ["ipanttrusteddomainsid"]
dom_name:
description: |
Domain name of the trusted domain. Can only be used when
`ipaapi_context: server`.
type: string
type: str
required: false
aliases: ["ipanttrusteddomainname"]
auto_private_groups:
description: Auto creation of private groups.
type: string
type: str
required: false
choices: ["true", "false", "hybrid"]
aliases: ["ipaautoprivategroups"]
state:
description: The state to ensure.
type: str
choices: ["present", "absent"]
default: present
required: true
required: false
author:
- Rafael Guterres Jeffman (@rjeffman)
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -184,8 +191,8 @@ def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["cn"],
default=None, required=True),
name=dict(type="list", elements="str", aliases=["cn"],
required=True),
# present
base_id=dict(required=False, type='int',
aliases=["ipabaseid"], default=None),

View File

@@ -3,7 +3,7 @@
# Authors:
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2020 Red Hat
# Copyright (C) 2020-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -32,23 +32,29 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipalocation
short description: Manage FreeIPA location
short_description: Manage FreeIPA location
description: Manage FreeIPA location
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description: The list of location name strings.
type: list
elements: str
required: true
aliases: ["idnsname"]
description:
description: The IPA location string
type: str
required: false
state:
description: The state to ensure.
type: str
choices: ["present", "absent"]
default: present
required: true
required: false
author:
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -94,8 +100,8 @@ def gen_args(description):
def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
name=dict(type="list", aliases=["idnsname"],
default=None, required=True),
name=dict(type="list", elements="str", aliases=["idnsname"],
required=True),
# present
description=dict(required=False, type='str', default=None),
# state

View File

@@ -0,0 +1,436 @@
# -*- coding: utf-8 -*-
# Authors:
# Denis Karpelevich <dkarpele@redhat.com>
#
# Copyright (C) 2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
"status": ["preview"],
}
DOCUMENTATION = """
---
module: ipanetgroup
short_description: NIS entities can be stored in netgroups.
description: |
A netgroup is a group used for permission checking.
It can contain both user and host values.
extends_documentation_fragment:
- ipamodule_base_docs
- ipamodule_base_docs.delete_continue
options:
name:
description: The list of netgroup name strings.
required: true
type: list
elements: str
aliases: ["cn"]
description:
description: Netgroup description
required: false
type: str
aliases: ["desc"]
nisdomain:
description: NIS domain name
required: false
type: str
aliases: ["nisdomainname"]
nomembers:
description: Suppress processing of membership attributes
required: false
type: bool
user:
description: List of user names assigned to this netgroup.
required: false
type: list
elements: str
aliases: ["users"]
group:
description: List of group names assigned to this netgroup.
required: false
type: list
elements: str
aliases: ["groups"]
host:
description: List of host names assigned to this netgroup.
required: false
type: list
elements: str
aliases: ["hosts"]
hostgroup:
description: List of host group names assigned to this netgroup.
required: false
type: list
elements: str
aliases: ["hostgroups"]
netgroup:
description: List of netgroup names assigned to this netgroup.
required: false
type: list
elements: str
aliases: ["netgroups"]
action:
description: Work on netgroup or member level
required: false
type: str
default: netgroup
choices: ["member", "netgroup"]
state:
description: The state to ensure.
type: str
choices: ["present", "absent"]
default: present
author:
- Denis Karpelevich (@dkarpele)
"""
EXAMPLES = """
- name: Ensure netgroup my_netgroup1 is present
ipanetgroup:
ipaadmin_password: SomeADMINpassword
name: my_netgroup1
description: My netgroup 1
- name: Ensure netgroup my_netgroup1 is absent
ipanetgroup:
ipaadmin_password: SomeADMINpassword
name: my_netgroup1
state: absent
- name: Ensure netgroup is present with user "user1"
ipanetgroup:
ipaadmin_password: SomeADMINpassword
name: TestNetgroup1
user: user1
action: member
- name: Ensure netgroup user, "user1", is absent
ipanetgroup:
ipaadmin_password: SomeADMINpassword
name: TestNetgroup1
user: "user1"
action: member
state: absent
- name: Ensure netgroup is present with members
ipanetgroup:
ipaadmin_password: SomeADMINpassword
name: TestNetgroup1
user: user1,user2
group: group1
host: host1
hostgroup: ipaservers
netgroup: admins
action: member
- name: Ensure 2 netgroups TestNetgroup1, admins are absent
ipanetgroup:
ipaadmin_password: SomeADMINpassword
name:
- TestNetgroup1
- admins
state: absent
"""
RETURN = """
"""
from ansible.module_utils.ansible_freeipa_module import \
IPAAnsibleModule, compare_args_ipa, gen_add_del_lists, \
gen_add_list, gen_intersection_list, ensure_fqdn
def find_netgroup(module, name):
"""Find if a netgroup with the given name already exist."""
_args = {
"all": True,
"cn": name,
}
# `netgroup_find` is used here instead of `netgroup_show` to workaround
# FreeIPA bug https://pagure.io/freeipa/issue/9284.
# `ipa netgroup-show hostgroup` shows hostgroup - it's a bug.
# `ipa netgroup-find hostgroup` doesn't show hostgroup - it's correct.
_result = module.ipa_command("netgroup_find", name, _args)
if len(_result["result"]) > 1:
module.fail_json(
msg="There is more than one netgroup '%s'" % name)
elif len(_result["result"]) == 1:
return _result["result"][0]
return None
def gen_args(description, nisdomain, nomembers):
_args = {}
if description is not None:
_args["description"] = description
if nisdomain is not None:
_args["nisdomainname"] = nisdomain
if nomembers is not None:
_args["nomembers"] = nomembers
return _args
def gen_member_args(user, group, host, hostgroup, netgroup):
_args = {}
if user is not None:
_args["memberuser_user"] = user
if group is not None:
_args["memberuser_group"] = group
if host is not None:
_args["memberhost_host"] = host
if hostgroup is not None:
_args["memberhost_hostgroup"] = hostgroup
if netgroup is not None:
_args["member_netgroup"] = netgroup
return _args
def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", elements="str", aliases=["cn"],
required=True),
# present
description=dict(required=False, type='str',
aliases=["desc"], default=None),
nisdomain=dict(required=False, type='str',
aliases=["nisdomainname"], default=None),
nomembers=dict(required=False, type='bool', default=None),
user=dict(required=False, type='list', elements="str",
aliases=["users"], default=None),
group=dict(required=False, type='list', elements="str",
aliases=["groups"], default=None),
host=dict(required=False, type='list', elements="str",
aliases=["hosts"], default=None),
hostgroup=dict(required=False, type='list', elements="str",
aliases=["hostgroups"], default=None),
netgroup=dict(required=False, type='list', elements="str",
aliases=["netgroups"], default=None),
action=dict(required=False, type="str", default="netgroup",
choices=["member", "netgroup"]),
# state
state=dict(type="str", default="present",
choices=["present", "absent"]),
),
supports_check_mode=True,
ipa_module_options=["delete_continue"],
)
ansible_module._ansible_debug = True
# Get parameters
# general
names = ansible_module.params_get("name")
# present
description = ansible_module.params_get("description")
nisdomain = ansible_module.params_get("nisdomain")
nomembers = ansible_module.params_get("nomembers")
user = ansible_module.params_get_lowercase("user")
group = ansible_module.params_get_lowercase("group")
host = ansible_module.params_get_lowercase("host")
hostgroup = ansible_module.params_get_lowercase("hostgroup")
netgroup = ansible_module.params_get_lowercase("netgroup")
action = ansible_module.params_get("action")
# state
state = ansible_module.params_get("state")
# Check parameters
invalid = []
if state == "present":
if len(names) != 1:
ansible_module.fail_json(
msg="Only one netgroup can be added at a time.")
if action == "member":
invalid = ["description", "nisdomain", "nomembers"]
if state == "absent":
if len(names) < 1:
ansible_module.fail_json(msg="No name given.")
if len(names) != 1 and action == "member":
ansible_module.fail_json(msg="Members can be removed only from one"
" netgroup at a time.")
invalid = ["description", "nisdomain", "nomembers"]
if action == "netgroup":
invalid.extend(["user", "group", "host", "hostgroup", "netgroup"])
ansible_module.params_fail_used_invalid(invalid, state)
# Init
exit_args = {}
# Connect to IPA API
with ansible_module.ipa_connect():
# Ensure fqdn host names, use default domain for simple names
if host is not None:
default_domain = ansible_module.ipa_get_domain()
host = [ensure_fqdn(_host, default_domain).lower()
for _host in host]
commands = []
for name in names:
# Make sure netgroup exists
res_find = find_netgroup(ansible_module, name)
user_add, user_del = [], []
group_add, group_del = [], []
host_add, host_del = [], []
hostgroup_add, hostgroup_del = [], []
netgroup_add, netgroup_del = [], []
# Create command
if state == "present":
# Generate args
args = gen_args(description, nisdomain, nomembers)
if action == "netgroup":
# Found the netgroup
if res_find is not None:
# For all settings is args, check if there are
# different settings in the find result.
# If yes: modify
if not compare_args_ipa(ansible_module, args,
res_find):
commands.append([name, "netgroup_mod", args])
else:
commands.append([name, "netgroup_add", args])
res_find = {}
member_args = gen_member_args(
user, group, host, hostgroup, netgroup
)
if not compare_args_ipa(ansible_module, member_args,
res_find):
# Generate addition and removal lists
user_add, user_del = gen_add_del_lists(
user, res_find.get("memberuser_user"))
group_add, group_del = gen_add_del_lists(
group, res_find.get("memberuser_group"))
host_add, host_del = gen_add_del_lists(
host, res_find.get("memberhost_host"))
hostgroup_add, hostgroup_del = gen_add_del_lists(
hostgroup, res_find.get("memberhost_hostgroup"))
netgroup_add, netgroup_del = gen_add_del_lists(
netgroup, res_find.get("member_netgroup"))
elif action == "member":
if res_find is None:
ansible_module.fail_json(msg="No netgroup '%s'" % name)
# Reduce add lists for memberuser_user, memberuser_group,
# member_service and member_external to new entries
# only that are not in res_find.
user_add = gen_add_list(
user, res_find.get("memberuser_user"))
group_add = gen_add_list(
group, res_find.get("memberuser_group"))
host_add = gen_add_list(
host, res_find.get("memberhost_host"))
hostgroup_add = gen_add_list(
hostgroup, res_find.get("memberhost_hostgroup"))
netgroup_add = gen_add_list(
netgroup, res_find.get("member_netgroup"))
elif state == "absent":
if action == "netgroup":
if res_find is not None:
commands.append([name, "netgroup_del", {}])
elif action == "member":
if res_find is None:
ansible_module.fail_json(msg="No netgroup '%s'" % name)
user_del = gen_intersection_list(
user, res_find.get("memberuser_user"))
group_del = gen_intersection_list(
group, res_find.get("memberuser_group"))
host_del = gen_intersection_list(
host, res_find.get("memberhost_host"))
hostgroup_del = gen_intersection_list(
hostgroup, res_find.get("memberhost_hostgroup"))
netgroup_del = gen_intersection_list(
netgroup, res_find.get("member_netgroup"))
else:
ansible_module.fail_json(msg="Unknown state '%s'" % state)
# manage members
# setup member args for add/remove members.
add_member_args = {
"user": user_add,
"group": group_add,
"host": host_add,
"hostgroup": hostgroup_add,
"netgroup": netgroup_add
}
del_member_args = {
"user": user_del,
"group": group_del,
"host": host_del,
"hostgroup": hostgroup_del,
"netgroup": netgroup_del
}
# Add members
add_members = any([user_add, group_add, host_add,
hostgroup_add, netgroup_add])
if add_members:
commands.append(
[name, "netgroup_add_member", add_member_args]
)
# Remove members
remove_members = any([user_del, group_del, host_del,
hostgroup_del, netgroup_del])
if remove_members:
commands.append(
[name, "netgroup_remove_member", del_member_args]
)
# Execute commands
changed = ansible_module.execute_ipa_commands(
commands, fail_on_member_errors=True)
# Done
ansible_module.exit_json(changed=changed, **exit_args)
if __name__ == "__main__":
main()

View File

@@ -2,8 +2,9 @@
# Authors:
# Seth Kress <kresss@gmail.com>
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2020 Red Hat
# Copyright (C) 2020-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -32,13 +33,15 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipapermission
short description: Manage FreeIPA permission
short_description: Manage FreeIPA permission
description: Manage FreeIPA permission and permission members
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description: The permission name string.
type: list
elements: str
required: true
aliases: ["cn"]
right:
@@ -46,52 +49,64 @@ options:
required: false
choices: ["read", "search", "compare", "write", "add", "delete", "all"]
type: list
elements: str
aliases: ["ipapermright"]
attrs:
description: All attributes to which the permission applies
required: false
type: list
elements: str
bindtype:
description: Bind rule type
required: false
choices: ["permission", "all", "anonymous"]
type: str
choices: ["permission", "all", "anonymous", "self"]
aliases: ["ipapermbindruletype"]
subtree:
description: Subtree to apply permissions to
type: str
required: false
aliases: ["ipapermlocation"]
filter:
extra_target_filter:
description: Extra target filter
required: false
type: list
aliases: ["extratargetfilter"]
elements: str
aliases: ["filter", "extratargetfilter"]
rawfilter:
description: All target filters
required: false
type: list
elements: str
aliases: ["ipapermtargetfilter"]
target:
description: Optional DN to apply the permission to
type: str
required: false
aliases: ["ipapermtarget"]
targetto:
description: Optional DN subtree where an entry can be moved to
type: str
required: false
aliases: ["ipapermtargetto"]
targetfrom:
description: Optional DN subtree from where an entry can be moved
type: str
required: false
aliases: ["ipapermtargetfrom"]
memberof:
description: Target members of a group (sets memberOf targetfilter)
required: false
type: list
elements: str
targetgroup:
description: User group to apply permissions to (sets target)
type: str
required: false
aliases: ["targetgroup"]
object_type:
description: Type of IPA object (sets subtree and objectClass targetfilter)
type: str
required: false
aliases: ["type"]
no_members:
@@ -100,18 +115,24 @@ options:
type: bool
rename:
description: Rename the permission object
type: str
required: false
aliases: ["new_name"]
action:
description: Work on permission or member privilege level.
type: str
choices: ["permission", "member"]
default: permission
required: false
state:
description: The state to ensure.
type: str
choices: ["present", "absent", "renamed"]
default: present
required: true
required: false
author:
- Seth Kress (@kresss)
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -203,24 +224,26 @@ def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["cn"],
default=None, required=True),
name=dict(type="list", elements="str", aliases=["cn"],
required=True),
# present
right=dict(type="list", aliases=["ipapermright"], default=None,
required=False,
right=dict(type="list", elements="str", aliases=["ipapermright"],
default=None, required=False,
choices=["read", "search", "compare", "write", "add",
"delete", "all"]),
attrs=dict(type="list", default=None, required=False),
attrs=dict(type="list", elements="str", default=None,
required=False),
# Note: bindtype has a default of permission for Adds.
bindtype=dict(type="str", aliases=["ipapermbindruletype"],
default=None, require=False, choices=["permission",
default=None, required=False, choices=["permission",
"all", "anonymous", "self"]),
subtree=dict(type="str", aliases=["ipapermlocation"], default=None,
required=False),
extra_target_filter=dict(type="list", aliases=["filter",
"extratargetfilter"], default=None,
required=False),
rawfilter=dict(type="list", aliases=["ipapermtargetfilter"],
extra_target_filter=dict(type="list", elements="str",
aliases=["filter", "extratargetfilter"],
default=None, required=False),
rawfilter=dict(type="list", elements="str",
aliases=["ipapermtargetfilter"],
default=None, required=False),
target=dict(type="str", aliases=["ipapermtarget"], default=None,
required=False),
@@ -228,11 +251,12 @@ def main():
default=None, required=False),
targetfrom=dict(type="str", aliases=["ipapermtargetfrom"],
default=None, required=False),
memberof=dict(type="list", default=None, required=False),
memberof=dict(type="list", elements="str", default=None,
required=False),
targetgroup=dict(type="str", default=None, required=False),
object_type=dict(type="str", aliases=["type"], default=None,
required=False),
no_members=dict(type=bool, default=None, require=False),
no_members=dict(type="bool", default=None, required=False),
rename=dict(type="str", default=None, required=False,
aliases=["new_name"]),
action=dict(type="str", default="permission",

View File

@@ -2,8 +2,9 @@
# Authors:
# Rafael Guterres Jeffman <rjeffman@redhat.com>
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2020 Red Hat
# Copyright (C) 2020-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -35,35 +36,46 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipaprivilege
short description: Manage FreeIPA privilege
short_description: Manage FreeIPA privilege
description: Manage FreeIPA privilege and privilege members
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description: The list of privilege name strings.
type: list
elements: str
required: true
aliases: ["cn"]
description:
description: Privilege description
type: str
required: false
rename:
description: Rename the privilege object.
type: str
required: false
aliases: ["new_name"]
permission:
description: Permissions to be added to the privilege.
type: list
elements: str
required: false
action:
description: Work on privilege or member level.
type: str
choices: ["privilege", "member"]
default: privilege
required: false
state:
description: The state to ensure.
type: str
choices: ["present", "absent", "renamed"]
default: present
required: true
required: false
author:
- Rafael Guterres Jeffman (@rjeffman)
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -134,13 +146,14 @@ def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["cn"],
default=None, required=True),
name=dict(type="list", elements="str", aliases=["cn"],
required=True),
# present
description=dict(required=False, type='str', default=None),
rename=dict(required=False, type='str', default=None,
aliases=["new_name"], ),
permission=dict(required=False, type='list', default=None),
permission=dict(required=False, type='list', elements="str",
default=None),
action=dict(type="str", default="privilege",
choices=["member", "privilege"]),
# state

View File

@@ -2,8 +2,9 @@
# Authors:
# Thomas Woerner <twoerner@redhat.com>
# Rafael Guterres Jeffman <rjeffman@redhat.com>
#
# Copyright (C) 2019 Red Hat
# Copyright (C) 2019-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -32,70 +33,105 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipapwpolicy
short description: Manage FreeIPA pwpolicies
short_description: Manage FreeIPA pwpolicies
description: Manage FreeIPA pwpolicies
extends_documentation_fragment:
- ipamodule_base_docs
options:
ipaadmin_principal:
description: The admin principal
default: admin
ipaadmin_password:
description: The admin password
required: false
name:
description: The group name
type: list
elements: str
required: false
aliases: ["cn"]
maxlife:
description: Maximum password lifetime (in days)
type: int
type: str
required: false
aliases: ["krbmaxpwdlife"]
minlife:
description: Minimum password lifetime (in hours)
type: int
type: str
required: false
aliases: ["krbminpwdlife"]
history:
description: Password history size
type: int
type: str
required: false
aliases: ["krbpwdhistorylength"]
minclasses:
description: Minimum number of character classes
type: int
type: str
required: false
aliases: ["krbpwdmindiffchars"]
minlength:
description: Minimum length of password
type: int
type: str
required: false
aliases: ["krbpwdminlength"]
priority:
description: Priority of the policy (higher number means lower priority)
type: int
type: str
required: false
aliases: ["cospriority"]
maxfail:
description: Consecutive failures before lockout
type: int
type: str
required: false
aliases: ["krbpwdmaxfailure"]
failinterval:
description: Period after which failure count will be reset (seconds)
type: int
type: str
required: false
aliases: ["krbpwdfailurecountinterval"]
lockouttime:
description: Period for which lockout is enforced (seconds)
type: int
type: str
required: false
aliases: ["krbpwdlockoutduration"]
maxrepeat:
description: >
Maximum number of same consecutive characters.
Requires IPA 4.9+
type: str
required: false
aliases: ["ipapwdmaxrepeat"]
maxsequence:
description: >
The maximum length of monotonic character sequences (abcd).
Requires IPA 4.9+
type: str
required: false
aliases: ["ipapwdmaxsequence"]
dictcheck:
description: >
Check if the password is a dictionary word.
Requires IPA 4.9+
type: str
required: false
aliases: ["ipapwdictcheck"]
usercheck:
description: >
Check if the password contains the username.
Requires IPA 4.9+
type: str
required: false
aliases: ["ipapwdusercheck"]
gracelimit:
description: >
Number of LDAP authentications allowed after expiration.
Requires IPA 4.10.1+
type: str
required: false
aliases: ["passwordgracelimit"]
state:
description: State to ensure
type: str
default: present
choices: ["present", "absent"]
author:
- Thomas Woerner
- Thomas Woerner (@t-woerner)
- Rafael Guterres Jeffman (@rjeffman)
"""
EXAMPLES = """
@@ -135,8 +171,10 @@ def find_pwpolicy(module, name):
return None
def gen_args(maxlife, minlife, history, minclasses, minlength, priority,
maxfail, failinterval, lockouttime):
def gen_args(module,
maxlife, minlife, history, minclasses, minlength, priority,
maxfail, failinterval, lockouttime, maxrepeat, maxsequence,
dictcheck, usercheck, gracelimit):
_args = {}
if maxlife is not None:
_args["krbmaxpwdlife"] = maxlife
@@ -156,34 +194,89 @@ def gen_args(maxlife, minlife, history, minclasses, minlength, priority,
_args["krbpwdfailurecountinterval"] = failinterval
if lockouttime is not None:
_args["krbpwdlockoutduration"] = lockouttime
if maxrepeat is not None:
_args["ipapwdmaxrepeat"] = maxrepeat
if maxsequence is not None:
_args["ipapwdmaxsequence"] = maxsequence
if dictcheck is not None:
if module.ipa_check_version("<", "4.9.10"):
# Allowed values: "TRUE", "FALSE", ""
_args["ipapwddictcheck"] = "TRUE" if dictcheck is True else \
"FALSE" if dictcheck is False else dictcheck
else:
_args["ipapwddictcheck"] = dictcheck
if usercheck is not None:
if module.ipa_check_version("<", "4.9.10"):
# Allowed values: "TRUE", "FALSE", ""
_args["ipapwdusercheck"] = "TRUE" if usercheck is True else \
"FALSE" if usercheck is False else usercheck
else:
_args["ipapwdusercheck"] = usercheck
if gracelimit is not None:
_args["passwordgracelimit"] = gracelimit
return _args
def check_supported_params(
module, maxrepeat, maxsequence, dictcheck, usercheck, gracelimit
):
# All password checking parameters were added by the same commit,
# so we only need to test one of them.
has_password_check = module.ipa_command_param_exists(
"pwpolicy_add", "ipapwdmaxrepeat")
# check if gracelimit is supported
has_gracelimit = module.ipa_command_param_exists(
"pwpolicy_add", "passwordgracelimit")
# If needed, report unsupported password checking paramteres
if (
not has_password_check
and any([maxrepeat, maxsequence, dictcheck, usercheck])
):
module.fail_json(
msg="Your IPA version does not support arguments: "
"maxrepeat, maxsequence, dictcheck, usercheck.")
if not has_gracelimit and gracelimit is not None:
module.fail_json(
msg="Your IPA version does not support 'gracelimit'.")
def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["cn"], default=None,
required=False),
name=dict(type="list", elements="str", aliases=["cn"],
default=None, required=False),
# present
maxlife=dict(type="int", aliases=["krbmaxpwdlife"], default=None),
minlife=dict(type="int", aliases=["krbminpwdlife"], default=None),
history=dict(type="int", aliases=["krbpwdhistorylength"],
maxlife=dict(type="str", aliases=["krbmaxpwdlife"], default=None),
minlife=dict(type="str", aliases=["krbminpwdlife"], default=None),
history=dict(type="str", aliases=["krbpwdhistorylength"],
default=None),
minclasses=dict(type="int", aliases=["krbpwdmindiffchars"],
minclasses=dict(type="str", aliases=["krbpwdmindiffchars"],
default=None),
minlength=dict(type="int", aliases=["krbpwdminlength"],
minlength=dict(type="str", aliases=["krbpwdminlength"],
default=None),
priority=dict(type="int", aliases=["cospriority"], default=None),
maxfail=dict(type="int", aliases=["krbpwdmaxfailure"],
priority=dict(type="str", aliases=["cospriority"], default=None),
maxfail=dict(type="str", aliases=["krbpwdmaxfailure"],
default=None),
failinterval=dict(type="int",
failinterval=dict(type="str",
aliases=["krbpwdfailurecountinterval"],
default=None),
lockouttime=dict(type="int", aliases=["krbpwdlockoutduration"],
lockouttime=dict(type="str", aliases=["krbpwdlockoutduration"],
default=None),
maxrepeat=dict(type="str", aliases=["ipapwdmaxrepeat"],
default=None),
maxsequence=dict(type="str", aliases=["ipapwdmaxsequence"],
default=None),
dictcheck=dict(type="str", aliases=["ipapwdictcheck"],
default=None),
usercheck=dict(type="str", aliases=["ipapwdusercheck"],
default=None),
gracelimit=dict(type="str", aliases=["passwordgracelimit"],
default=None),
# state
state=dict(type="str", default="present",
choices=["present", "absent"]),
@@ -208,6 +301,11 @@ def main():
maxfail = ansible_module.params_get("maxfail")
failinterval = ansible_module.params_get("failinterval")
lockouttime = ansible_module.params_get("lockouttime")
maxrepeat = ansible_module.params_get("maxrepeat")
maxsequence = ansible_module.params_get("maxsequence")
dictcheck = ansible_module.params_get("dictcheck")
usercheck = ansible_module.params_get("usercheck")
gracelimit = ansible_module.params_get("gracelimit")
# state
state = ansible_module.params_get("state")
@@ -231,10 +329,57 @@ def main():
msg="'global_policy' can not be made absent.")
invalid = ["maxlife", "minlife", "history", "minclasses",
"minlength", "priority", "maxfail", "failinterval",
"lockouttime"]
"lockouttime", "maxrepeat", "maxsequence", "dictcheck",
"usercheck", "gracelimit"]
ansible_module.params_fail_used_invalid(invalid, state)
# Ensure parameter values are valid and have proper type.
def int_or_empty_param(value, param):
if value is not None and value != "":
try:
value = int(value)
except ValueError:
ansible_module.fail_json(
msg="Invalid value '%s' for argument '%s'" % (value, param)
)
return value
maxlife = int_or_empty_param(maxlife, "maxlife")
minlife = int_or_empty_param(minlife, "minlife")
history = int_or_empty_param(history, "history")
minclasses = int_or_empty_param(minclasses, "minclasses")
minlength = int_or_empty_param(minlength, "minlength")
priority = int_or_empty_param(priority, "priority")
maxfail = int_or_empty_param(maxfail, "maxfail")
failinterval = int_or_empty_param(failinterval, "failinterval")
lockouttime = int_or_empty_param(lockouttime, "lockouttime")
maxrepeat = int_or_empty_param(maxrepeat, "maxrepeat")
maxsequence = int_or_empty_param(maxsequence, "maxsequence")
gracelimit = int_or_empty_param(gracelimit, "gracelimit")
def bool_or_empty_param(value, param): # pylint: disable=R1710
# As of Ansible 2.14, values True, False, Yes an No, with variable
# capitalization are accepted by Ansible.
if not value:
return value
if value in ["TRUE", "True", "true", "YES", "Yes", "yes"]:
return True
if value in ["FALSE", "False", "false", "NO", "No", "no"]:
return False
ansible_module.fail_json(
msg="Invalid value '%s' for argument '%s'." % (value, param)
)
dictcheck = bool_or_empty_param(dictcheck, "dictcheck")
usercheck = bool_or_empty_param(usercheck, "usercheck")
# Ensure gracelimit has proper limit.
if gracelimit:
if gracelimit < -1:
ansible_module.fail_json(
msg="'gracelimit' must be no less than -1")
# Init
changed = False
@@ -242,6 +387,11 @@ def main():
with ansible_module.ipa_connect():
check_supported_params(
ansible_module, maxrepeat, maxsequence, dictcheck, usercheck,
gracelimit
)
commands = []
for name in names:
@@ -251,9 +401,11 @@ def main():
# Create command
if state == "present":
# Generate args
args = gen_args(maxlife, minlife, history, minclasses,
args = gen_args(ansible_module,
maxlife, minlife, history, minclasses,
minlength, priority, maxfail, failinterval,
lockouttime)
lockouttime, maxrepeat, maxsequence, dictcheck,
usercheck, gracelimit)
# Found the pwpolicy
if res_find is not None:

View File

@@ -3,8 +3,9 @@
# Authors:
# Rafael Guterres Jeffman <rjeffman@redhat.com>
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2020 Red Hat
# Copyright (C) 2020-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -34,47 +35,71 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: iparole
short description: Manage FreeIPA role
short_description: Manage FreeIPA role
description: Manage FreeIPA role
extends_documentation_fragment:
- ipamodule_base_docs
options:
role:
name:
description: The list of role name strings.
type: list
elements: str
required: true
aliases: ["cn"]
description:
description: A description for the role.
type: str
required: false
rename:
description: Rename the role object.
type: str
required: false
aliases: ["new_name"]
privilege:
description: List of privileges
type: list
elements: str
required: false
user:
description: List of users.
type: list
elements: str
required: false
group:
description: List of groups.
type: list
elements: str
required: false
host:
description: List of hosts.
type: list
elements: str
required: false
hostgroup:
description: List of hostgroups.
type: list
elements: str
required: false
service:
description: List of services.
type: list
elements: str
required: false
action:
description: Work on role or member level.
type: str
choices: ["role", "member"]
default: role
required: false
state:
description: The state to ensure.
type: str
choices: ["present", "absent", "renamed"]
default: present
required: true
required: false
author:
- Rafael Guterres Jeffman (@rjeffman)
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -394,19 +419,25 @@ def create_module():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# generalgroups
name=dict(type="list", aliases=["cn"], default=None,
name=dict(type="list", elements="str", aliases=["cn"],
required=True),
# present
description=dict(required=False, type="str", default=None),
rename=dict(required=False, type="str", default=None,
aliases=["new_name"]),
# members
privilege=dict(required=False, type='list', default=None),
user=dict(required=False, type='list', default=None),
group=dict(required=False, type='list', default=None),
host=dict(required=False, type='list', default=None),
hostgroup=dict(required=False, type='list', default=None),
service=dict(required=False, type='list', default=None),
privilege=dict(required=False, type='list', elements="str",
default=None),
user=dict(required=False, type='list', elements="str",
default=None),
group=dict(required=False, type='list', elements="str",
default=None),
host=dict(required=False, type='list', elements="str",
default=None),
hostgroup=dict(required=False, type='list', elements="str",
default=None),
service=dict(required=False, type='list', elements="str",
default=None),
# state
action=dict(type="str", default="role",

View File

@@ -3,7 +3,7 @@
# Authors:
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2020 Red Hat
# Copyright (C) 2020-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -32,33 +32,43 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipaselfservice
short description: Manage FreeIPA selfservices
short_description: Manage FreeIPA selfservices
description: Manage FreeIPA selfservices and selfservice attributes
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description: The list of selfservice name strings.
type: list
elements: str
required: true
aliases: ["aciname"]
permission:
description: Permissions to grant (read, write). Default is write.
type: list
elements: str
required: false
aliases: ["permissions"]
attribute:
description: Attribute list to which the selfservice applies
type: list
elements: str
required: false
aliases: ["attrs"]
action:
description: Work on selfservice or member level.
type: str
choices: ["selfservice", "member"]
default: selfservice
required: false
state:
description: The state to ensure.
type: str
choices: ["present", "absent"]
default: present
required: true
required: false
author:
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -130,13 +140,13 @@ def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["aciname"], default=None,
name=dict(type="list", elements="str", aliases=["aciname"],
required=True),
# present
permission=dict(required=False, type='list',
permission=dict(required=False, type='list', elements="str",
aliases=["permissions"], default=None),
attribute=dict(required=False, type='list', aliases=["attrs"],
default=None),
attribute=dict(required=False, type='list', elements="str",
aliases=["attrs"], default=None),
action=dict(type="str", default="selfservice",
choices=["member", "selfservice"]),
# state

View File

@@ -3,7 +3,7 @@
# Authors:
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2021 Red Hat
# Copyright (C) 2021-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -32,13 +32,15 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipaserver
short description: Manage FreeIPA server
short_description: Manage FreeIPA server
description: Manage FreeIPA server
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description: The list of server name strings.
type: list
elements: str
required: true
aliases: ["cn"]
location:
@@ -46,6 +48,7 @@ options:
The server location string.
"" for location reset.
Only in state: present.
type: str
required: false
aliases: ["ipalocation_location"]
service_weight:
@@ -96,9 +99,12 @@ options:
type: bool
state:
description: The state to ensure.
type: str
choices: ["present", "absent"]
default: present
required: true
required: false
author:
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -244,8 +250,8 @@ def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["cn"],
default=None, required=True),
name=dict(type="list", elements="str", aliases=["cn"],
required=True),
# present
location=dict(required=False, type='str',
aliases=["ipalocation_location"], default=None),

View File

@@ -1,9 +1,11 @@
# -*- coding: utf-8 -*-
# Authors:
# Denis Karpelevich <dkarpele@redhat.com>
# Rafael Guterres Jeffman <rjeffman@redhat.com>
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2019 Red Hat
# Copyright (C) 2019-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -33,28 +35,155 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipaservice
short description: Manage FreeIPA service
short_description: Manage FreeIPA service
description: Manage FreeIPA service
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description: The service to manage
type: list
elements: str
required: true
aliases: ["service"]
services:
description: The list of service dicts.
type: list
elements: dict
suboptions:
name:
description: The service to manage
type: str
required: true
aliases: ["service"]
certificate:
description: Base-64 encoded service certificate.
required: false
type: list
elements: str
aliases: ["usercertificate"]
pac_type:
description: Supported PAC type.
required: false
choices: ["MS-PAC", "PAD", "NONE", ""]
type: list
elements: str
aliases: ["pac_type", "ipakrbauthzdata"]
auth_ind:
description: Defines an allow list for Authentication Indicators.
type: list
elements: str
required: false
choices: ["otp", "radius", "pkinit", "hardened", ""]
aliases: ["krbprincipalauthind"]
skip_host_check:
description: Skip checking if host object exists.
required: False
type: bool
force:
description: Force principal name even if host is not in DNS.
required: False
type: bool
requires_pre_auth:
description: Pre-authentication is required for the service.
required: false
type: bool
aliases: ["ipakrbrequirespreauth"]
ok_as_delegate:
description: Client credentials may be delegated to the service.
required: false
type: bool
aliases: ["ipakrbokasdelegate"]
ok_to_auth_as_delegate:
description: Allow service to authenticate on behalf of a client.
required: false
type: bool
aliases: ["ipakrboktoauthasdelegate"]
principal:
description: List of principal aliases for the service.
required: false
type: list
elements: str
aliases: ["krbprincipalname"]
smb:
description: Add a SMB service.
required: false
type: bool
netbiosname:
description: NETBIOS name for the SMB service.
required: false
type: str
host:
description: Host that can manage the service.
required: false
type: list
elements: str
aliases: ["managedby_host"]
allow_create_keytab_user:
description: Users allowed to create a keytab of this host.
required: false
type: list
elements: str
aliases: ["ipaallowedtoperform_write_keys_user"]
allow_create_keytab_group:
description: Groups allowed to create a keytab of this host.
required: false
type: list
elements: str
aliases: ["ipaallowedtoperform_write_keys_group"]
allow_create_keytab_host:
description: Hosts allowed to create a keytab of this host.
required: false
type: list
elements: str
aliases: ["ipaallowedtoperform_write_keys_host"]
allow_create_keytab_hostgroup:
description: Host group allowed to create a keytab of this host.
required: false
type: list
elements: str
aliases: ["ipaallowedtoperform_write_keys_hostgroup"]
allow_retrieve_keytab_user:
description: User allowed to retrieve a keytab of this host.
required: false
type: list
elements: str
aliases: ["ipaallowedtoperform_read_keys_user"]
allow_retrieve_keytab_group:
description: Groups allowed to retrieve a keytab of this host.
required: false
type: list
elements: str
aliases: ["ipaallowedtoperform_read_keys_group"]
allow_retrieve_keytab_host:
description: Hosts allowed to retrieve a keytab of this host.
required: false
type: list
elements: str
aliases: ["ipaallowedtoperform_read_keys_host"]
allow_retrieve_keytab_hostgroup:
description: Host groups allowed to retrieve a keytab of this host.
required: false
type: list
elements: str
aliases: ["ipaallowedtoperform_read_keys_hostgroup"]
certificate:
description: Base-64 encoded service certificate.
required: false
type: list
elements: str
aliases: ["usercertificate"]
pac_type:
description: Supported PAC type.
required: false
choices: ["MS-PAC", "PAD", "NONE", ""]
type: list
elements: str
aliases: ["pac_type", "ipakrbauthzdata"]
auth_ind:
description: Defines a whitelist for Authentication Indicators.
description: Defines an allow list for Authentication Indicators.
type: list
elements: str
required: false
choices: ["otp", "radius", "pkinit", "hardened", ""]
aliases: ["krbprincipalauthind"]
@@ -70,24 +199,22 @@ options:
description: Pre-authentication is required for the service.
required: false
type: bool
default: False
aliases: ["ipakrbrequirespreauth"]
ok_as_delegate:
description: Client credentials may be delegated to the service.
required: false
type: bool
default: False
aliases: ["ipakrbokasdelegate"]
ok_to_auth_as_delegate:
description: Allow service to authenticate on behalf of a client.
required: false
type: bool
default: False
aliases: ["ipakrboktoauthasdelegate"]
principal:
description: List of principal aliases for the service.
required: false
type: list
elements: str
aliases: ["krbprincipalname"]
smb:
description: Add a SMB service.
@@ -101,63 +228,75 @@ options:
description: Host that can manage the service.
required: false
type: list
elements: str
aliases: ["managedby_host"]
allow_create_keytab_user:
description: Users allowed to create a keytab of this host.
required: false
type: list
elements: str
aliases: ["ipaallowedtoperform_write_keys_user"]
allow_create_keytab_group:
description: Groups allowed to create a keytab of this host.
required: false
type: list
elements: str
aliases: ["ipaallowedtoperform_write_keys_group"]
allow_create_keytab_host:
description: Hosts allowed to create a keytab of this host.
required: false
type: list
elements: str
aliases: ["ipaallowedtoperform_write_keys_host"]
allow_create_keytab_hostgroup:
description: Host group allowed to create a keytab of this host.
required: false
type: list
elements: str
aliases: ["ipaallowedtoperform_write_keys_hostgroup"]
allow_retrieve_keytab_user:
description: User allowed to retrieve a keytab of this host.
required: false
type: list
elements: str
aliases: ["ipaallowedtoperform_read_keys_user"]
allow_retrieve_keytab_group:
description: Groups allowed to retrieve a keytab of this host.
required: false
type: list
elements: str
aliases: ["ipaallowedtoperform_read_keys_group"]
allow_retrieve_keytab_host:
description: Hosts allowed to retrieve a keytab of this host.
required: false
type: list
elements: str
aliases: ["ipaallowedtoperform_read_keys_host"]
allow_retrieve_keytab_hostgroup:
description: Host groups allowed to retrieve a keytab of this host.
required: false
type: list
elements: str
aliases: ["ipaallowedtoperform_read_keys_hostgroup"]
continue:
delete_continue:
description:
Continuous mode. Don't stop on errors. Valid only if `state` is `absent`.
required: false
default: True
type: bool
aliases: ["continue"]
action:
description: Work on service or member level
type: str
default: service
choices: ["member", "service"]
state:
description: State to ensure
type: str
default: present
choices: ["present", "absent", "disabled"]
author:
- Rafael Jeffman
- Rafael Guterres Jeffman (@rjeffman)
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -222,6 +361,15 @@ EXAMPLES = """
- host1.example.com
- host2.example.com
action: member
# Ensure multiple services are present.
- ipaservice:
ipaadmin_password: SomeADMINpassword
services:
- name: HTTP/www.example.com
host:
- host1.example.com
- name: HTTP/www.service.com
"""
RETURN = """
@@ -231,6 +379,9 @@ from ansible.module_utils.ansible_freeipa_module import \
IPAAnsibleModule, compare_args_ipa, encode_certificate, \
gen_add_del_lists, gen_add_list, gen_intersection_list, ipalib_errors, \
api_get_realm, to_text
from ansible.module_utils import six
if six.PY3:
unicode = str
def find_service(module, name):
@@ -304,8 +455,9 @@ def check_parameters(module, state, action, names):
'allow_retrieve_keytab_hostgroup']
if state == 'present':
if len(names) != 1:
module.fail_json(msg="Only one service can be added at a time.")
if names is not None and len(names) != 1:
module.fail_json(msg="Only one service can be added at a time "
"using 'name'.")
if action == 'service':
invalid = ['delete_continue']
@@ -321,9 +473,6 @@ def check_parameters(module, state, action, names):
invalid.append('delete_continue')
elif state == 'absent':
if len(names) < 1:
module.fail_json(msg="No name given.")
if action == "service":
invalid.extend(invalid_not_member)
else:
@@ -343,64 +492,85 @@ def check_parameters(module, state, action, names):
def init_ansible_module():
service_spec = dict(
# service attributesstr
certificate=dict(type="list", elements="str",
aliases=['usercertificate'],
default=None, required=False),
principal=dict(type="list", elements="str",
aliases=["krbprincipalname"], default=None),
smb=dict(type="bool", required=False),
netbiosname=dict(type="str", required=False),
pac_type=dict(type="list", elements="str",
aliases=["ipakrbauthzdata"],
choices=["MS-PAC", "PAD", "NONE", ""]),
auth_ind=dict(type="list", elements="str",
aliases=["krbprincipalauthind"],
choices=["otp", "radius", "pkinit", "hardened", ""]),
skip_host_check=dict(type="bool"),
force=dict(type="bool"),
requires_pre_auth=dict(
type="bool", aliases=["ipakrbrequirespreauth"]),
ok_as_delegate=dict(type="bool", aliases=["ipakrbokasdelegate"]),
ok_to_auth_as_delegate=dict(type="bool",
aliases=["ipakrboktoauthasdelegate"]),
host=dict(type="list", elements="str", aliases=["managedby_host"],
required=False),
allow_create_keytab_user=dict(
type="list", elements="str", required=False, no_log=False,
aliases=['ipaallowedtoperform_write_keys_user']),
allow_retrieve_keytab_user=dict(
type="list", elements="str", required=False, no_log=False,
aliases=['ipaallowedtoperform_read_keys_user']),
allow_create_keytab_group=dict(
type="list", elements="str", required=False, no_log=False,
aliases=['ipaallowedtoperform_write_keys_group']),
allow_retrieve_keytab_group=dict(
type="list", elements="str", required=False, no_log=False,
aliases=['ipaallowedtoperform_read_keys_group']),
allow_create_keytab_host=dict(
type="list", elements="str", required=False, no_log=False,
aliases=['ipaallowedtoperform_write_keys_host']),
allow_retrieve_keytab_host=dict(
type="list", elements="str", required=False, no_log=False,
aliases=['ipaallowedtoperform_read_keys_host']),
allow_create_keytab_hostgroup=dict(
type="list", elements="str", required=False, no_log=False,
aliases=['ipaallowedtoperform_write_keys_hostgroup']),
allow_retrieve_keytab_hostgroup=dict(
type="list", elements="str", required=False, no_log=False,
aliases=['ipaallowedtoperform_read_keys_hostgroup']),
delete_continue=dict(type="bool", required=False,
aliases=['continue']),
)
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["service"], default=None,
required=True),
# service attributesstr
certificate=dict(type="list", aliases=['usercertificate'],
default=None, required=False),
principal=dict(type="list", aliases=["krbprincipalname"],
default=None),
smb=dict(type="bool", required=False),
netbiosname=dict(type="str", required=False),
pac_type=dict(type="list", aliases=["ipakrbauthzdata"],
choices=["MS-PAC", "PAD", "NONE", ""]),
auth_ind=dict(type="list",
aliases=["krbprincipalauthind"],
choices=["otp", "radius", "pkinit", "hardened", ""]),
skip_host_check=dict(type="bool"),
force=dict(type="bool"),
requires_pre_auth=dict(
type="bool", aliases=["ipakrbrequirespreauth"]),
ok_as_delegate=dict(type="bool", aliases=["ipakrbokasdelegate"]),
ok_to_auth_as_delegate=dict(type="bool",
aliases=["ipakrboktoauthasdelegate"]),
host=dict(type="list", aliases=["managedby_host"], required=False),
allow_create_keytab_user=dict(
type="list", required=False,
aliases=['ipaallowedtoperform_write_keys_user']),
allow_retrieve_keytab_user=dict(
type="list", required=False,
aliases=['ipaallowedtoperform_read_keys_user']),
allow_create_keytab_group=dict(
type="list", required=False,
aliases=['ipaallowedtoperform_write_keys_group']),
allow_retrieve_keytab_group=dict(
type="list", required=False,
aliases=['ipaallowedtoperform_read_keys_group']),
allow_create_keytab_host=dict(
type="list", required=False,
aliases=['ipaallowedtoperform_write_keys_host']),
allow_retrieve_keytab_host=dict(
type="list", required=False,
aliases=['ipaallowedtoperform_read_keys_host']),
allow_create_keytab_hostgroup=dict(
type="list", required=False,
aliases=['ipaallowedtoperform_write_keys_hostgroup']),
allow_retrieve_keytab_hostgroup=dict(
type="list", required=False,
aliases=['ipaallowedtoperform_read_keys_hostgroup']),
delete_continue=dict(type="bool", required=False,
aliases=['continue']),
name=dict(type="list", elements="str", aliases=["service"],
default=None, required=False),
services=dict(type="list",
default=None,
options=dict(
# Here name is a simple string
name=dict(type="str", required=True,
aliases=["service"]),
# Add service specific parameters
**service_spec
),
elements='dict',
required=False),
# action
action=dict(type="str", default="service",
choices=["member", "service"]),
# state
state=dict(type="str", default="present",
choices=["present", "absent", "disabled"]),
# Add service specific parameters for simple use case
**service_spec
),
mutually_exclusive=[["name", "services"]],
required_one_of=[["name", "services"]],
supports_check_mode=True,
)
@@ -416,10 +586,17 @@ def main():
# general
names = ansible_module.params_get("name")
services = ansible_module.params_get("services")
# service attributes
principal = ansible_module.params_get("principal")
certificate = ansible_module.params_get("certificate")
# Any leading or trailing whitespace is removed while adding the
# certificate with serive_add_cert. To be able to compare the results
# from service_show with the given certificates we have to remove the
# white space also.
if certificate is not None:
certificate = [cert.strip() for cert in certificate]
pac_type = ansible_module.params_get("pac_type", allow_empty_string=True)
auth_ind = ansible_module.params_get("auth_ind", allow_empty_string=True)
skip_host_check = ansible_module.params_get("skip_host_check")
@@ -442,8 +619,16 @@ def main():
state = ansible_module.params_get("state")
# check parameters
if (names is None or len(names) < 1) and \
(services is None or len(services) < 1):
ansible_module.fail_json(msg="At least one name or services is "
"required")
check_parameters(ansible_module, state, action, names)
# Use services if names is None
if services is not None:
names = services
# Init
changed = False
@@ -460,8 +645,45 @@ def main():
commands = []
keytab_members = ["user", "group", "host", "hostgroup"]
service_set = set()
for name in names:
for service in names:
if isinstance(service, dict):
name = service.get("name")
if name in service_set:
ansible_module.fail_json(
msg="service '%s' is used more than once" % name)
service_set.add(name)
principal = service.get("principal")
certificate = service.get("certificate")
# Any leading or trailing whitespace is removed while adding
# the certificate with serive_add_cert. To be able to compare
# the results from service_show with the given certificates
# we have to remove the white space also.
if certificate is not None:
certificate = [cert.strip() for cert in certificate]
pac_type = service.get("pac_type")
auth_ind = service.get("auth_ind")
skip_host_check = service.get("skip_host_check")
if skip_host_check and not has_skip_host_check:
ansible_module.fail_json(
msg="Skipping host check is not supported by your IPA "
"version")
force = service.get("force")
requires_pre_auth = service.get("requires_pre_auth")
ok_as_delegate = service.get("ok_as_delegate")
ok_to_auth_as_delegate = service.get("ok_to_auth_as_delegate")
smb = service.get("smb")
netbiosname = service.get("netbiosname")
host = service.get("host")
delete_continue = service.get("delete_continue")
elif isinstance(service, (str, unicode)):
name = service
else:
ansible_module.fail_json(msg="Service '%s' is not valid" %
repr(service))
res_find = find_service(ansible_module, name)
res_principals = []

View File

@@ -32,7 +32,7 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipaservicedelegationrule
short description: Manage FreeIPA servicedelegationrule
short_description: Manage FreeIPA servicedelegationrule
description: |
Manage FreeIPA servicedelegationrule and servicedelegationrule members
extends_documentation_fragment:
@@ -40,6 +40,8 @@ extends_documentation_fragment:
options:
name:
description: The list of servicedelegationrule name strings.
type: list
elements: str
required: true
aliases: ["cn"]
principal:
@@ -49,22 +51,30 @@ options:
host/fqdn@REALM, alias$, alias$@REALM, where fqdn and fqdn@REALM
are host principals and the same as host/fqdn and host/fqd
Host princpals are only usable with IPA versions 4.9.0 and up.
type: list
elements: str
required: false
target:
description: |
The list of service delegation targets.
type: list
elements: str
required: false
aliases: ["servicedelegationtarget"]
action:
description: Work on servicedelegationrule or member level.
type: str
choices: ["servicedelegationrule", "member"]
default: servicedelegationrule
required: false
state:
description: The state to ensure.
type: str
choices: ["present", "absent"]
default: present
required: true
required: false
author:
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -161,11 +171,12 @@ def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["cn"], default=None,
name=dict(type="list", elements="str", aliases=["cn"],
required=True),
# present
principal=dict(required=False, type='list', default=None),
target=dict(required=False, type='list',
principal=dict(required=False, type='list', elements="str",
default=None),
target=dict(required=False, type='list', elements="str",
aliases=["servicedelegationtarget"], default=None),
action=dict(type="str", default="servicedelegationrule",

View File

@@ -32,7 +32,7 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipaservicedelegationtarget
short description: Manage FreeIPA servicedelegationtarget
short_description: Manage FreeIPA servicedelegationtarget
description: |
Manage FreeIPA servicedelegationtarget and servicedelegationtarget members
extends_documentation_fragment:
@@ -40,6 +40,8 @@ extends_documentation_fragment:
options:
name:
description: The list of servicedelegationtarget name strings.
type: list
elements: str
required: true
aliases: ["cn"]
principal:
@@ -49,17 +51,23 @@ options:
host/fqdn@REALM, alias$, alias$@REALM, where fqdn and fqdn@REALM
are host principals and the same as host/fqdn and host/fqdn@REALM.
Host princpals are only usable with IPA versions 4.9.0 and up.
type: list
elements: str
required: false
action:
description: Work on servicedelegationtarget or member level.
type: str
choices: ["servicedelegationtarget", "member"]
default: servicedelegationtarget
required: false
state:
description: The state to ensure.
type: str
choices: ["present", "absent"]
default: present
required: true
required: false
author:
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -121,10 +129,11 @@ def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["cn"], default=None,
name=dict(type="list", elements="str", aliases=["cn"],
required=True),
# present
principal=dict(required=False, type='list', default=None),
principal=dict(required=False, type='list', elements="str",
default=None),
action=dict(type="str", default="servicedelegationtarget",
choices=["member", "servicedelegationtarget"]),

View File

@@ -2,8 +2,9 @@
# Authors:
# Rafael Guterres Jeffman <rjeffman@redhat.com>
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2019 Red Hat
# Copyright (C) 2019-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -33,24 +34,29 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipasudocmd
short description: Manage FreeIPA sudo command
short_description: Manage FreeIPA sudo command
description: Manage FreeIPA sudo command
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description: The sudo command
type: list
elements: str
required: true
aliases: ["sudocmd"]
description:
description: The command description
type: str
required: false
state:
description: State to ensure
type: str
default: present
choices: ["present", "absent"]
author:
- Rafael Jeffman
- Rafael Guterres Jeffman (@rjeffman)
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -103,7 +109,7 @@ def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["sudocmd"], default=None,
name=dict(type="list", elements="str", aliases=["sudocmd"],
required=True),
# present
description=dict(type="str", default=None),

View File

@@ -2,8 +2,9 @@
# Authors:
# Rafael Guterres Jeffman <rjeffman@redhat.com>
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2019 Red Hat
# Copyright (C) 2019-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -33,17 +34,20 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipasudocmdgroup
short description: Manage FreeIPA sudocmd groups
short_description: Manage FreeIPA sudocmd groups
description: Manage FreeIPA sudocmd groups
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description: The sudocmodgroup name
required: false
type: list
elements: str
required: true
aliases: ["cn"]
description:
description: The sudocmdgroup description
type: str
required: false
nomembers:
description: Suppress processing of membership attributes
@@ -53,16 +57,20 @@ options:
description: List of sudocmds assigned to this sudocmdgroup.
required: false
type: list
elements: str
action:
description: Work on sudocmdgroup or member level
default: hostgroup
type: str
default: sudocmdgroup
choices: ["member", "sudocmdgroup"]
state:
description: State to ensure
type: str
default: present
choices: ["present", "absent"]
author:
- Rafael Guterres Jeffman
- Rafael Guterres Jeffman (@rjeffman)
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -140,12 +148,13 @@ def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["cn"], default=None,
name=dict(type="list", elements="str", aliases=["cn"],
required=True),
# present
description=dict(type="str", default=None),
nomembers=dict(required=False, type='bool', default=None),
sudocmd=dict(required=False, type='list', default=None),
sudocmd=dict(required=False, type='list', elements="str",
default=None),
action=dict(type="str", default="sudocmdgroup",
choices=["member", "sudocmdgroup"]),
# state

View File

@@ -2,8 +2,9 @@
# Authors:
# Rafael Guterres Jeffman <rjeffman@redhat.com>
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2019 Red Hat
# Copyright (C) 2019-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -32,36 +33,46 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipasudorule
short description: Manage FreeIPA sudo rules
short_description: Manage FreeIPA sudo rules
description: Manage FreeIPA sudo rules
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description: The sudorule name
type: list
elements: str
required: true
aliases: ["cn"]
description:
description: The sudorule description
type: str
required: false
user:
description: List of users assigned to the sudo rule.
type: list
elements: str
required: false
usercategory:
description: User category the sudo rule applies to
type: str
required: false
choices: ["all", ""]
aliases: ["usercat"]
group:
description: List of user groups assigned to the sudo rule.
type: list
elements: str
required: false
runasgroupcategory:
description: RunAs Group category applied to the sudo rule.
type: str
required: false
choices: ["all", ""]
aliases: ["runasgroupcat"]
runasusercategory:
description: RunAs User category applied to the sudorule.
type: str
required: false
choices: ["all", ""]
aliases: ["runasusercat"]
@@ -73,12 +84,15 @@ options:
description: List of host names assigned to this sudorule.
required: false
type: list
elements: str
hostgroup:
description: List of host groups assigned to this sudorule.
required: false
type: list
elements: str
hostcategory:
description: Host category the sudo rule applies to.
type: str
required: false
choices: ["all", ""]
aliases: ["hostcat"]
@@ -86,20 +100,25 @@ options:
description: List of allowed sudocmds assigned to this sudorule.
required: false
type: list
elements: str
allow_sudocmdgroup:
description: List of allowed sudocmd groups assigned to this sudorule.
required: false
type: list
elements: str
deny_sudocmd:
description: List of denied sudocmds assigned to this sudorule.
required: false
type: list
elements: str
deny_sudocmdgroup:
description: List of denied sudocmd groups assigned to this sudorule.
required: false
type: list
elements: str
cmdcategory:
description: Command category the sudo rule applies to
type: str
required: false
choices: ["all", ""]
aliases: ["cmdcat"]
@@ -107,29 +126,41 @@ options:
description: Order to apply this rule.
required: false
type: int
aliases: ["sudoorder"]
sudooption:
description: List of sudo options.
required: false
type: list
elements: str
aliases: ["options"]
runasuser:
description: List of users for Sudo to execute as.
required: false
type: list
elements: str
runasgroup:
description: List of groups for Sudo to execute as.
required: false
type: list
elements: str
hostmask:
description: Host masks of allowed hosts.
required: false
type: list
elements: str
action:
description: Work on sudorule or member level
type: str
default: sudorule
choices: ["member", "sudorule"]
state:
description: State to ensure
type: str
default: present
choices: ["present", "absent", "enabled", "disabled"]
author:
- Rafael Jeffman
- Rafael Guterres Jeffman (@rjeffman)
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -162,19 +193,28 @@ EXAMPLES = """
hostgroup: cluster
action: member
# Ensure sudo rule for usercategory "all"
# Ensure sudo rule for usercategory "all" is enabled
- ipasudorule:
ipaadmin_password: SomeADMINpassword
name: allusers
usercategory: all
action: enabled
state: enabled
# Ensure sudo rule for hostcategory "all"
# Ensure sudo rule for hostcategory "all" is enabled
- ipasudorule:
ipaadmin_password: SomeADMINpassword
name: allhosts
hostcategory: all
action: enabled
state: enabled
# Ensure sudo rule applies for hosts with hostmasks
- ipasudorule:
ipaadmin_password: SomeADMINpassword
name: testrule1
hostmask:
- 192.168.122.1/24
- 192.168.120.1/24
action: member
# Ensure Sudo Rule tesrule1 is absent
- ipasudorule:
@@ -188,7 +228,7 @@ RETURN = """
from ansible.module_utils.ansible_freeipa_module import \
IPAAnsibleModule, compare_args_ipa, gen_add_del_lists, gen_add_list, \
gen_intersection_list, api_get_domain, ensure_fqdn
gen_intersection_list, api_get_domain, ensure_fqdn, netaddr, to_text
def find_sudorule(module, name):
@@ -236,7 +276,7 @@ def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["cn"], default=None,
name=dict(type="list", elements="str", aliases=["cn"],
required=True),
# present
description=dict(required=False, type="str", default=None),
@@ -245,14 +285,24 @@ def main():
hostcategory=dict(required=False, type="str", default=None,
choices=["all", ""], aliases=['hostcat']),
nomembers=dict(required=False, type='bool', default=None),
host=dict(required=False, type='list', default=None),
hostgroup=dict(required=False, type='list', default=None),
user=dict(required=False, type='list', default=None),
group=dict(required=False, type='list', default=None),
allow_sudocmd=dict(required=False, type="list", default=None),
deny_sudocmd=dict(required=False, type="list", default=None),
allow_sudocmdgroup=dict(required=False, type="list", default=None),
deny_sudocmdgroup=dict(required=False, type="list", default=None),
host=dict(required=False, type='list', elements="str",
default=None),
hostgroup=dict(required=False, type='list', elements="str",
default=None),
hostmask=dict(required=False, type='list', elements="str",
default=None),
user=dict(required=False, type='list', elements="str",
default=None),
group=dict(required=False, type='list', elements="str",
default=None),
allow_sudocmd=dict(required=False, type="list", elements="str",
default=None),
deny_sudocmd=dict(required=False, type="list", elements="str",
default=None),
allow_sudocmdgroup=dict(required=False, type="list",
elements="str", default=None),
deny_sudocmdgroup=dict(required=False, type="list", elements="str",
default=None),
cmdcategory=dict(required=False, type="str", default=None,
choices=["all", ""], aliases=['cmdcat']),
runasusercategory=dict(required=False, type="str", default=None,
@@ -261,11 +311,13 @@ def main():
runasgroupcategory=dict(required=False, type="str", default=None,
choices=["all", ""],
aliases=['runasgroupcat']),
runasuser=dict(required=False, type="list", default=None),
runasgroup=dict(required=False, type="list", default=None),
runasuser=dict(required=False, type="list", elements="str",
default=None),
runasgroup=dict(required=False, type="list", elements="str",
default=None),
order=dict(type="int", required=False, aliases=['sudoorder']),
sudooption=dict(required=False, type='list', default=None,
aliases=["options"]),
sudooption=dict(required=False, type='list', elements="str",
default=None, aliases=["options"]),
action=dict(type="str", default="sudorule",
choices=["member", "sudorule"]),
# state
@@ -298,6 +350,7 @@ def main():
nomembers = ansible_module.params_get("nomembers") # noqa
host = ansible_module.params_get("host")
hostgroup = ansible_module.params_get_lowercase("hostgroup")
hostmask = ansible_module.params_get("hostmask")
user = ansible_module.params_get_lowercase("user")
group = ansible_module.params_get_lowercase("group")
allow_sudocmd = ansible_module.params_get('allow_sudocmd')
@@ -315,6 +368,10 @@ def main():
# state
state = ansible_module.params_get("state")
# ensure hostmasks are network cidr
if hostmask is not None:
hostmask = [to_text(netaddr.IPNetwork(x).cidr) for x in hostmask]
# Check parameters
invalid = []
@@ -346,7 +403,7 @@ def main():
"cmdcategory", "runasusercategory",
"runasgroupcategory", "nomembers", "order"]
if action == "sudorule":
invalid.extend(["host", "hostgroup", "user", "group",
invalid.extend(["host", "hostgroup", "hostmask", "user", "group",
"runasuser", "runasgroup", "allow_sudocmd",
"allow_sudocmdgroup", "deny_sudocmd",
"deny_sudocmdgroup", "sudooption"])
@@ -360,7 +417,7 @@ def main():
"disabled")
invalid = ["description", "usercategory", "hostcategory",
"cmdcategory", "runasusercategory", "runasgroupcategory",
"nomembers", "nomembers", "host", "hostgroup",
"nomembers", "nomembers", "host", "hostgroup", "hostmask",
"user", "group", "allow_sudocmd", "allow_sudocmdgroup",
"deny_sudocmd", "deny_sudocmdgroup", "runasuser",
"runasgroup", "order", "sudooption"]
@@ -389,6 +446,7 @@ def main():
user_add, user_del = [], []
group_add, group_del = [], []
hostgroup_add, hostgroup_del = [], []
hostmask_add, hostmask_del = [], []
allow_cmd_add, allow_cmd_del = [], []
allow_cmdgroup_add, allow_cmdgroup_del = [], []
deny_cmd_add, deny_cmd_del = [], []
@@ -454,6 +512,9 @@ def main():
hostgroup_add, hostgroup_del = gen_add_del_lists(
hostgroup, res_find.get('memberhost_hostgroup', []))
hostmask_add, hostmask_del = gen_add_del_lists(
hostmask, res_find.get('hostmask', []))
user_add, user_del = gen_add_del_lists(
user, res_find.get('memberuser_user', []))
@@ -520,6 +581,9 @@ def main():
if hostgroup is not None:
hostgroup_add = gen_add_list(
hostgroup, res_find.get("memberhost_hostgroup"))
if hostmask is not None:
hostmask_add = gen_add_list(
hostmask, res_find.get("hostmask"))
if user is not None:
user_add = gen_add_list(
user, res_find.get("memberuser_user"))
@@ -592,6 +656,10 @@ def main():
hostgroup_del = gen_intersection_list(
hostgroup, res_find.get("memberhost_hostgroup"))
if hostmask is not None:
hostmask_del = gen_intersection_list(
hostmask, res_find.get("hostmask"))
if user is not None:
user_del = gen_intersection_list(
user, res_find.get("memberuser_user"))
@@ -683,18 +751,19 @@ def main():
# Manage members.
# Manage hosts and hostgroups
if host_add or hostgroup_add:
commands.append([name, "sudorule_add_host",
{
"host": host_add,
"hostgroup": hostgroup_add,
}])
if host_del or hostgroup_del:
commands.append([name, "sudorule_remove_host",
{
"host": host_del,
"hostgroup": hostgroup_del,
}])
if any([host_add, hostgroup_add, hostmask_add]):
params = {"host": host_add, "hostgroup": hostgroup_add}
# An empty Hostmask cannot be used, or IPA API will fail.
if hostmask_add:
params["hostmask"] = hostmask_add
commands.append([name, "sudorule_add_host", params])
if any([host_del, hostgroup_del, hostmask_del]):
params = {"host": host_del, "hostgroup": hostgroup_del}
# An empty Hostmask cannot be used, or IPA API will fail.
if hostmask_del:
params["hostmask"] = hostmask_del
commands.append([name, "sudorule_remove_host", params])
# Manage users and groups
if user_add or group_add:

View File

@@ -3,7 +3,7 @@
# Authors:
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2019 Red Hat
# Copyright (C) 2019-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -32,36 +32,44 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipatopologysegment
short description: Manage FreeIPA topology segments
short_description: Manage FreeIPA topology segments
description: Manage FreeIPA topology segments
extends_documentation_fragment:
- ipamodule_base_docs
options:
suffix:
description: Topology suffix
type: str
required: true
choices: ["domain", "ca", "domain+ca"]
name:
description: Topology segment name, unique identifier.
type: str
required: false
aliases: ["cn"]
left:
description: Left replication node - an IPA server
type: str
required: false
aliases: ["leftnode"]
right:
description: Right replication node - an IPA server
type: str
required: false
aliases: ["rightnode"]
direction:
description: The direction a segment will be reinitialized
type: str
required: false
choices: ["left-to-right", "right-to-left"]
state:
description: State to ensure
type: str
default: present
choices: ["present", "absent", "enabled", "disabled", "reinitialized",
"checked" ]
author:
- Thomas Woerner
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -178,7 +186,8 @@ def find_left_right_cn(module, suffix, left, right, name):
def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
suffix=dict(choices=["domain", "ca", "domain+ca"], required=True),
suffix=dict(type="str", choices=["domain", "ca", "domain+ca"],
required=True),
name=dict(type="str", aliases=["cn"], default=None),
left=dict(type="str", aliases=["leftnode"], default=None),
right=dict(type="str", aliases=["rightnode"], default=None),

View File

@@ -3,7 +3,7 @@
# Authors:
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2019 Red Hat
# Copyright (C) 2019-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -32,21 +32,23 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipatopologysuffix
short description: Verify FreeIPA topology suffix
short_description: Verify FreeIPA topology suffix
description: Verify FreeIPA topology suffix
extends_documentation_fragment:
- ipamodule_base_docs
options:
suffix:
description: Topology suffix
type: str
required: true
choices: ["domain", "ca"]
state:
description: State to ensure
type: str
default: verified
choices: ["verified"]
author:
- Thomas Woerner
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -65,7 +67,7 @@ from ansible.module_utils.ansible_freeipa_module import IPAAnsibleModule
def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
suffix=dict(choices=["domain", "ca"], required=True),
suffix=dict(type="str", choices=["domain", "ca"], required=True),
state=dict(type="str", default="verified",
choices=["verified"]),
),

View File

@@ -2,8 +2,9 @@
# Authors:
# Rob Verduijn <rob.verduijn@gmail.com>
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2019 By Rob Verduijn
# Copyright (C) 2019-2022 By Rob Verduijn
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -39,62 +40,75 @@ options:
realm:
description:
- Realm name
type: str
required: true
trust_type:
description:
- Trust type (ad for Active Directory, default)
type: str
default: ad
required: false
choices: ["ad"]
admin:
description:
- Active Directory domain administrator
type: str
required: false
password:
description:
- Active Directory domain administrator's password
type: str
required: false
server:
description:
- Domain controller for the Active Directory domain (optional)
type: str
required: false
trust_secret:
description:
- Shared secret for the trust
type: str
required: false
base_id:
description:
- First Posix ID of the range reserved for the trusted domain
type: int
required: false
range_size:
description:
- Size of the ID range reserved for the trusted domain
type: int
default: 200000
range_type:
description:
- Type of trusted domain ID range, one of ipa-ad-trust, ipa-ad-trust-posix
type: str
choices: ["ipa-ad-trust-posix", "ipa-ad-trust"]
default: ipa-ad-trust
required: false
two_way:
description:
- Establish bi-directional trust. By default trust is inbound one-way only.
type: bool
default: false
required: false
choices: ["true", "false"]
external:
description:
- Establish external trust to a domain in another forest.
- The trust is not transitive beyond the domain.
type: bool
default: false
required: false
choices: ["true", "false"]
state:
description: State to ensure
type: str
default: present
required: true
required: false
choices: ["present", "absent"]
author:
- Rob Verduijn
- Rob Verduijn (@RobVerduijn)
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -188,7 +202,7 @@ def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
realm=dict(type="str", default=None, required=True),
realm=dict(type="str", required=True),
# state
state=dict(type="str", default="present",
choices=["present", "absent"]),

View File

@@ -3,7 +3,7 @@
# Authors:
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2019 Red Hat
# Copyright (C) 2019-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -32,50 +32,68 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipauser
short description: Manage FreeIPA users
short_description: Manage FreeIPA users
description: Manage FreeIPA users
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description: The list of users (internally uid).
type: list
elements: str
required: false
aliases: ["login"]
users:
description: The list of user dicts (internally uid).
options:
type: list
elements: dict
suboptions:
name:
description: The user (internally uid).
type: str
required: true
aliases: ["login"]
first:
description: The first name
description: The first name. Required if user does not exist.
type: str
required: false
aliases: ["givenname"]
last:
description: The last name
description: The last name. Required if user doesnot exst.
type: str
required: false
aliases: ["sn"]
fullname:
description: The full name
type: str
required: false
aliases: ["cn"]
displayname:
description: The display name
type: str
required: false
initials:
description: Initials
type: str
required: false
homedir:
description: The home directory
type: str
required: false
shell:
description: The login shell
type: str
required: false
aliases: ["loginshell"]
email:
description: List of email addresses
type: list
elements: str
required: false
principal:
description: The kerberos principal
type: list
elements: str
required: false
aliases: ["principalname", "krbprincipalname"]
principalexpiration:
@@ -84,6 +102,7 @@ options:
(possible formats: YYYYMMddHHmmssZ, YYYY-MM-ddTHH:mm:ssZ,
YYYY-MM-ddTHH:mmZ, YYYY-MM-ddZ, YYYY-MM-dd HH:mm:ssZ,
YYYY-MM-dd HH:mmZ) The trailing 'Z' can be skipped.
type: str
required: false
aliases: ["krbprincipalexpiration"]
passwordexpiration:
@@ -93,68 +112,94 @@ options:
YYYY-MM-ddTHH:mmZ, YYYY-MM-ddZ, YYYY-MM-dd HH:mm:ssZ,
YYYY-MM-dd HH:mmZ) The trailing 'Z' can be skipped.
Only usable with IPA versions 4.7 and up.
type: str
required: false
aliases: ["krbpasswordexpiration"]
password:
description: The user password
type: str
required: false
random:
description: Generate a random user password
required: false
type: bool
uid:
description: The UID
description: User ID Number (system will assign one if not provided)
type: int
required: false
aliases: ["uidnumber"]
gid:
description: The GID
description: Group ID Number
type: int
required: false
aliases: ["gidnumber"]
city:
description: City
type: str
required: false
userstate:
description: State/Province
type: str
required: false
aliases: ["st"]
postalcode:
description: Postalcode/ZIP
type: str
required: false
aliases: ["zip"]
phone:
description: List of telephone numbers
type: list
elements: str
required: false
aliases: ["telephonenumber"]
mobile:
description: List of mobile telephone numbers
type: list
elements: str
required: false
pager:
description: List of pager numbers
type: list
elements: str
required: false
fax:
description: List of fax numbers
type: list
elements: str
required: false
aliases: ["facsimiletelephonenumber"]
orgunit:
description: Org. Unit
type: str
required: false
aliases: ["ou"]
title:
description: The job title
type: str
required: false
manager:
description: List of managers
type: list
elements: str
required: false
carlicense:
description: List of car licenses
type: list
elements: str
required: false
sshpubkey:
description: List of SSH public keys
required: false
type: list
elements: str
aliases: ["ipasshpubkey"]
userauthtype:
description:
List of supported user authentication types
Use empty string to reset userauthtype to the initial value.
type: list
elements: str
choices: ['password', 'radius', 'otp', '']
required: false
aliases: ["ipauserauthtype"]
@@ -162,44 +207,65 @@ options:
description:
- User category
- (semantics placed on this attribute are for local interpretation)
type: list
elements: str
required: false
aliases: ["class"]
radius:
description: RADIUS proxy configuration
type: str
required: false
aliases: ["ipatokenradiusconfiglink"]
radiususer:
description: RADIUS proxy username
type: str
required: false
aliases: ["radiususername", "ipatokenradiususername"]
departmentnumber:
description: Department Number
type: list
elements: str
required: false
employeenumber:
description: Employee Number
type: str
required: false
employeetype:
description: Employee Type
type: str
required: false
preferredlanguage:
description: Preferred Language
type: str
required: false
certificate:
description: List of base-64 encoded user certificates
type: list
elements: str
required: false
aliases: ["usercertificate"]
certmapdata:
description:
- List of certificate mappings
- Only usable with IPA versions 4.5 and up.
options:
type: list
elements: dict
suboptions:
certificate:
description: Base-64 encoded user certificate
type: str
required: false
issuer:
description: Issuer of the certificate
type: str
required: false
subject:
description: Subject of the certificate
type: str
required: false
data:
description: Certmap data
type: str
required: false
required: false
noprivate:
@@ -212,35 +278,46 @@ options:
type: bool
required: false
first:
description: The first name
description: The first name. Required if user does not exist.
type: str
required: false
aliases: ["givenname"]
last:
description: The last name
description: The last name. Required if user doesnot exst.
type: str
required: false
aliases: ["sn"]
fullname:
description: The full name
type: str
required: false
aliases: ["cn"]
displayname:
description: The display name
type: str
required: false
initials:
description: Initials
type: str
required: false
homedir:
description: The home directory
type: str
required: false
shell:
description: The login shell
type: str
required: false
aliases: ["loginshell"]
email:
description: List of email addresses
type: list
elements: str
required: false
principal:
description: The kerberos principal
type: list
elements: str
required: false
aliases: ["principalname", "krbprincipalname"]
principalexpiration:
@@ -249,6 +326,7 @@ options:
(possible formats: YYYYMMddHHmmssZ, YYYY-MM-ddTHH:mm:ssZ,
YYYY-MM-ddTHH:mmZ, YYYY-MM-ddZ, YYYY-MM-dd HH:mm:ssZ,
YYYY-MM-dd HH:mmZ) The trailing 'Z' can be skipped.
type: str
required: false
aliases: ["krbprincipalexpiration"]
passwordexpiration:
@@ -258,68 +336,94 @@ options:
YYYY-MM-ddTHH:mmZ, YYYY-MM-ddZ, YYYY-MM-dd HH:mm:ssZ,
YYYY-MM-dd HH:mmZ) The trailing 'Z' can be skipped.
Only usable with IPA versions 4.7 and up.
type: str
required: false
aliases: ["krbpasswordexpiration"]
password:
description: The user password
type: str
required: false
random:
description: Generate a random user password
required: false
type: bool
uid:
description: The UID
description: User ID Number (system will assign one if not provided)
type: int
required: false
aliases: ["uidnumber"]
gid:
description: The GID
description: Group ID Number
type: int
required: false
aliases: ["gidnumber"]
city:
description: City
type: str
required: false
userstate:
description: State/Province
type: str
required: false
aliases: ["st"]
postalcode:
description: ZIP
description: Postalcode/ZIP
type: str
required: false
aliases: ["zip"]
phone:
description: List of telephone numbers
type: list
elements: str
required: false
aliases: ["telephonenumber"]
mobile:
description: List of mobile telephone numbers
type: list
elements: str
required: false
pager:
description: List of pager numbers
type: list
elements: str
required: false
fax:
description: List of fax numbers
type: list
elements: str
required: false
aliases: ["facsimiletelephonenumber"]
orgunit:
description: Org. Unit
type: str
required: false
aliases: ["ou"]
title:
description: The job title
type: str
required: false
manager:
description: List of managers
type: list
elements: str
required: false
carlicense:
description: List of car licenses
type: list
elements: str
required: false
sshpubkey:
description: List of SSH public keys
required: false
type: list
elements: str
aliases: ["ipasshpubkey"]
userauthtype:
description:
List of supported user authentication types
Use empty string to reset userauthtype to the initial value.
type: list
elements: str
choices: ['password', 'radius', 'otp', '']
required: false
aliases: ["ipauserauthtype"]
@@ -327,44 +431,65 @@ options:
description:
- User category
- (semantics placed on this attribute are for local interpretation)
type: list
elements: str
required: false
aliases: ["class"]
radius:
description: RADIUS proxy configuration
type: str
required: false
aliases: ["ipatokenradiusconfiglink"]
radiususer:
description: RADIUS proxy username
type: str
required: false
aliases: ["radiususername", "ipatokenradiususername"]
departmentnumber:
description: Department Number
type: list
elements: str
required: false
employeenumber:
description: Employee Number
type: str
required: false
employeetype:
description: Employee Type
type: str
required: false
preferredlanguage:
description: Preferred Language
type: str
required: false
certificate:
description: List of base-64 encoded user certificates
type: list
elements: str
required: false
aliases: ["usercertificate"]
certmapdata:
description:
- List of certificate mappings
- Only usable with IPA versions 4.5 and up.
options:
type: list
elements: dict
suboptions:
certificate:
description: Base-64 encoded user certificate
type: str
required: false
issuer:
description: Issuer of the certificate
type: str
required: false
subject:
description: Subject of the certificate
type: str
required: false
data:
description: Certmap data
type: str
required: false
required: false
noprivate:
@@ -378,24 +503,27 @@ options:
preserve:
description: Delete a user, keeping the entry available for future use
required: false
type: bool
update_password:
description:
Set password for a user in present state only on creation or always
default: "always"
type: str
choices: ["always", "on_create"]
required: false
action:
description: Work on user or member level
type: str
default: "user"
choices: ["member", "user"]
state:
description: State to ensure
type: str
default: present
choices: ["present", "absent",
"enabled", "disabled",
"unlocked", "undeleted"]
author:
- Thomas Woerner
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -420,6 +548,17 @@ EXAMPLES = """
first: brain
last: Acme
# Create multiple users pinky and brain
- ipauser:
ipaadmin_password: SomeADMINpassword
users:
- name: pinky
first: pinky
last: Acme
- name: brain
first: brain
last: Acme
# Delete user pinky, but preserved
- ipauser:
ipaadmin_password: SomeADMINpassword
@@ -445,6 +584,14 @@ EXAMPLES = """
name: pinky,brain
state: enabled
# Remove but preserve user pinky
- ipauser:
ipaadmin_password: SomeADMINpassword
users:
- name: pinky
preserve: yes
state: absent
# Remove user pinky and brain
- ipauser:
ipaadmin_password: SomeADMINpassword
@@ -457,17 +604,21 @@ user:
description: User dict with random password
returned: If random is yes and user did not exist or update_password is yes
type: dict
options:
contains:
randompassword:
description: The generated random password
returned: If only one user is handled by the module
type: str
returned: |
If only one user is handled by the module without using users parameter
name:
description: The user name of the user that got a new random password
returned: If several users are handled by the module
returned: |
If several users are handled by the module with the users parameter
type: dict
options:
contains:
randompassword:
description: The generated random password
type: str
returned: always
"""
@@ -704,11 +855,11 @@ def gen_certmapdata_args(certmapdata):
# pylint: disable=unused-argument
def result_handler(module, result, command, name, args, errors, exit_args,
one_name):
single_user):
if "random" in args and command in ["user_add", "user_mod"] \
and "randompassword" in result["result"]:
if one_name:
if single_user:
exit_args["randompassword"] = \
result["result"]["randompassword"]
else:
@@ -731,7 +882,7 @@ def result_handler(module, result, command, name, args, errors, exit_args,
# pylint: disable=unused-argument
def exception_handler(module, ex, errors, exit_args, one_name):
def exception_handler(module, ex, errors, exit_args, single_user):
msg = str(ex)
if "already contains" in msg \
or "does not contain" in msg:
@@ -752,16 +903,16 @@ def main():
initials=dict(type="str", default=None),
homedir=dict(type="str", default=None),
shell=dict(type="str", aliases=["loginshell"], default=None),
email=dict(type="list", default=None),
principal=dict(type="list", aliases=["principalname",
"krbprincipalname"],
email=dict(type="list", elements="str", default=None),
principal=dict(type="list", elements="str",
aliases=["principalname", "krbprincipalname"],
default=None),
principalexpiration=dict(type="str",
aliases=["krbprincipalexpiration"],
default=None),
passwordexpiration=dict(type="str",
aliases=["krbpasswordexpiration"],
default=None),
default=None, no_log=False),
password=dict(type="str", default=None, no_log=True),
random=dict(type='bool', default=None),
uid=dict(type="int", aliases=["uidnumber"], default=None),
@@ -769,33 +920,34 @@ def main():
city=dict(type="str", default=None),
userstate=dict(type="str", aliases=["st"], default=None),
postalcode=dict(type="str", aliases=["zip"], default=None),
phone=dict(type="list", aliases=["telephonenumber"], default=None),
mobile=dict(type="list", default=None),
pager=dict(type="list", default=None),
fax=dict(type="list", aliases=["facsimiletelephonenumber"],
default=None),
phone=dict(type="list", elements="str", aliases=["telephonenumber"],
default=None),
mobile=dict(type="list", elements="str", default=None),
pager=dict(type="list", elements="str", default=None),
fax=dict(type="list", elements="str",
aliases=["facsimiletelephonenumber"], default=None),
orgunit=dict(type="str", aliases=["ou"], default=None),
title=dict(type="str", default=None),
manager=dict(type="list", default=None),
carlicense=dict(type="list", default=None),
sshpubkey=dict(type="list", aliases=["ipasshpubkey"],
manager=dict(type="list", elements="str", default=None),
carlicense=dict(type="list", elements="str", default=None),
sshpubkey=dict(type="list", elements="str", aliases=["ipasshpubkey"],
default=None),
userauthtype=dict(type='list', aliases=["ipauserauthtype"],
default=None,
userauthtype=dict(type='list', elements="str",
aliases=["ipauserauthtype"], default=None,
choices=['password', 'radius', 'otp', '']),
userclass=dict(type="list", aliases=["class"],
userclass=dict(type="list", elements="str", aliases=["class"],
default=None),
radius=dict(type="str", aliases=["ipatokenradiusconfiglink"],
default=None),
radiususer=dict(type="str", aliases=["radiususername",
"ipatokenradiususername"],
default=None),
departmentnumber=dict(type="list", default=None),
departmentnumber=dict(type="list", elements="str", default=None),
employeenumber=dict(type="str", default=None),
employeetype=dict(type="str", default=None),
preferredlanguage=dict(type="str", default=None),
certificate=dict(type="list", aliases=["usercertificate"],
default=None),
certificate=dict(type="list", elements="str",
aliases=["usercertificate"], default=None),
certmapdata=dict(type="list", default=None,
options=dict(
# Here certificate is a simple string
@@ -812,14 +964,14 @@ def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# general
name=dict(type="list", aliases=["login"], default=None,
required=False),
name=dict(type="list", elements="str", aliases=["login"],
default=None, required=False),
users=dict(type="list",
aliases=["login"],
default=None,
options=dict(
# Here name is a simple string
name=dict(type="str", required=True),
name=dict(type="str", required=True,
aliases=["login"]),
# Add user specific parameters
**user_spec
),
@@ -1380,7 +1532,7 @@ def main():
changed = ansible_module.execute_ipa_commands(
commands, result_handler, exception_handler,
exit_args=exit_args, one_name=len(names) == 1)
exit_args=exit_args, single_user=users is None)
# Done
ansible_module.exit_json(changed=changed, user=exit_args)

View File

@@ -2,8 +2,9 @@
# Authors:
# Rafael Guterres Jeffman <rjeffman@redhat.com>
# Thomas Woerner <twoerner@redhat.com>
#
# Copyright (C) 2019 Red Hat
# Copyright (C) 2019-2022 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
@@ -32,130 +33,142 @@ ANSIBLE_METADATA = {
DOCUMENTATION = """
---
module: ipavault
short description: Manage vaults and secret vaults.
short_description: Manage vaults and secret vaults.
description: Manage vaults and secret vaults. KRA service must be enabled.
extends_documentation_fragment:
- ipamodule_base_docs
options:
name:
description: The vault name
type: list
elements: str
required: true
aliases: ["cn"]
description:
description: The vault description
type: str
required: false
public_key:
vault_public_key:
description: Base64 encode public key.
required: false
type: string
aliases: ["ipavaultpublickey", "vault_public_key"]
public_key_file:
type: str
aliases: ["ipavaultpublickey", "public_key", "new_public_key"]
vault_public_key_file:
description: Path to file with public key.
required: false
type: string
aliases: ["vault_public_key_file"]
type: str
aliases: ["public_key_file", "new_public_key_file"]
private_key:
description: Base64 encode private key.
required: false
type: string
type: str
aliases: ["ipavaultprivatekey", "vault_private_key"]
private_key_file:
description: Path to file with private key.
required: false
type: string
type: str
aliases: ["vault_private_key_file"]
password:
description: password to be used on symmetric vault.
required: false
type: string
type: str
aliases: ["ipavaultpassword", "vault_password", "old_password"]
password_file:
description: file with password to be used on symmetric vault.
required: false
type: string
type: str
aliases: ["vault_password_file", "old_password_file"]
new_password:
description: new password to be used on symmetric vault.
required: false
type: string
type: str
new_password_file:
description: file with new password to be used on symmetric vault.
required: false
type: string
salt:
type: str
vault_salt:
description: Vault salt.
required: false
type: list
aliases: ["ipavaultsalt", "vault_salt"]
type: str
aliases: ["ipavaultsalt", "salt"]
vault_type:
description: Vault types are based on security level.
required: true
default: symmetric
type: str
required: false
choices: ["standard", "symmetric", "asymmetric"]
aliases: ["ipavaulttype"]
service:
description: Any service can own one or more service vaults.
required: false
type: list
type: str
username:
description: Any user can own one or more user vaults.
required: false
type: string
type: str
aliases: ["user"]
shared:
description: Vault is shared.
required: false
type: boolean
type: bool
users:
description: Users that are member of the vault.
required: false
type: list
elements: str
groups:
description: Groups that are member of the vault.
required: false
type: list
elements: str
owners:
description: Users that are owners of the vault.
required: false
type: list
elements: str
aliases: ["ownerusers"]
ownergroups:
description: Groups that are owners of the vault.
required: false
type: list
elements: str
ownerservices:
description: Services that are owners of the vault.
required: false
type: list
elements: str
services:
description: Services that are member of the container.
required: false
type: list
elements: str
data:
description: Data to be stored in the vault.
required: false
type: string
type: str
aliases: ["ipavaultdata", "vault_data"]
in:
description: Path to file with data to be stored in the vault.
required: false
type: string
type: str
aliases: ["datafile_in"]
out:
description: Path to file to store data retrieved from the vault.
required: false
type: string
type: str
aliases: ["datafile_out"]
action:
description: Work on vault or member level.
type: str
default: vault
choices: ["vault", "member"]
choices: ["vault", "data", "member"]
state:
description: State to ensure
type: str
default: present
choices: ["present", "absent", "retrieved"]
author:
- Rafael Jeffman
- Rafael Guterres Jeffman (@rjeffman)
- Thomas Woerner (@t-woerner)
"""
EXAMPLES = """
@@ -307,11 +320,11 @@ vault:
description: Vault dict with archived data.
returned: If state is `retrieved`.
type: dict
options:
contains:
data:
description: The vault data.
returned: always
type: string
type: str
"""
import os
@@ -525,7 +538,7 @@ def check_encryption_params( # pylint: disable=unused-argument
if (
salt is not None
and not(
and not (
any([password, password_file])
and any([new_password, new_password_file])
)
@@ -587,7 +600,7 @@ def main():
ansible_module = IPAAnsibleModule(
argument_spec=dict(
# generalgroups
name=dict(type="list", aliases=["cn"], default=None,
name=dict(type="list", elements="str", aliases=["cn"],
required=True),
description=dict(required=False, type="str", default=None),
@@ -614,13 +627,19 @@ def main():
service=dict(type="str", required=False, default=None),
shared=dict(type="bool", required=False, default=None),
users=dict(required=False, type='list', default=None),
groups=dict(required=False, type='list', default=None),
services=dict(required=False, type='list', default=None),
owners=dict(required=False, type='list', default=None,
users=dict(required=False, type="list", elements="str",
default=None),
groups=dict(required=False, type="list", elements="str",
default=None),
services=dict(required=False, type="list", elements="str",
default=None),
owners=dict(required=False, type="list", elements="str",
default=None,
aliases=['ownerusers']),
ownergroups=dict(required=False, type='list', default=None),
ownerservices=dict(required=False, type='list', default=None),
ownergroups=dict(required=False, type="list", elements="str",
default=None),
ownerservices=dict(required=False, type="list", elements="str",
default=None),
vault_data=dict(type="str", required=False, default=None,
no_log=True, aliases=['ipavaultdata', 'data']),
datafile_in=dict(type="str", required=False, default=None,

View File

@@ -1,12 +1,10 @@
-r requirements-tests.txt
ipdb==0.13.4
pre-commit
flake8==4.0.1
flake8-bugbear
pylint==2.13.7
pre-commit==2.20.0
flake8==5.0.3
flake8-bugbear==22.10.27
pylint==2.14.4
wrapt == 1.14.0
pydocstyle==6.0.0
yamllint==1.26.3
ansible-lint==5.3.2
dnspython==2.2.0
netaddr==0.8.0
gssapi==1.7.2
yamllint==1.28.0
ansible-lint==6.6.1

3
requirements-docker.yml Normal file
View File

@@ -0,0 +1,3 @@
---
collections:
- name: community.docker

3
requirements-podman.yml Normal file
View File

@@ -0,0 +1,3 @@
---
collections:
- name: containers.podman

Some files were not shown because too many files have changed in this diff Show More