Commit Graph

2689 Commits

Author SHA1 Message Date
Varun Mylaraiah
268d4822f1 Merge pull request #1427 from t-woerner/ipagroup_query
ipagroup: Use PARAM_MAPPING and query state support
2026-07-20 12:17:21 +05:30
Thomas Woerner
0e2e6a6653 ipagroup: Use PARAM_MAPPING and query state support
The ipagroup module has been reworked to use the new PARAM_MAPPING
added to ansible_freeipa_module.

The member handling for user, group, service and membermanager has
been simplified by using gen_member_add_del_lists. The member entries
in PARAM_MAPPING are now marked with "member": True. This replaces the
manual calls to gen_add_del_lists, gen_add_list and
gen_intersection_list across separate action/state branches with a
single unified call. externalmember and idoverrideuser are still
handled manually since they need SID-based comparison.

The new query state allows to retrieve group information from IPA.
The query_param option controls which fields are returned: BASE for
essential fields, ALL for all fields, PKEY_ONLY for group names only,
or a list of specific field names.

Here is the updated documentation of the module:

    README-group.md

New tests for the query state can be found at:

    tests/group/test_group_query.yml
2026-07-16 17:09:37 +02:00
Rafael Guterres Jeffman
a45b8f0715 Merge pull request #1411 from t-woerner/build_collection_update_for_aah
build-collection.sh: Rename base README.md to make it invisible for AAH
2026-07-15 14:50:11 -03:00
Rafael Guterres Jeffman
79aed9ec84 Merge pull request #1428 from t-woerner/ipauser_query_fix
ipauser: Fix query state error handling and per-field conversion errors
2026-07-15 11:22:03 -03:00
Thomas Woerner
21258df45b ipauser: Fix query state error handling and per-field conversion errors
query_convert_result now reports the failing field name per-key instead
of aborting the whole loop with an unrelated try/except scope. main()
also rejects state=query with action=member and query is excluded from
rename's generated args and PARAM_MAPPING query fields.
2026-07-13 13:46:04 +02:00
Rafael Guterres Jeffman
9f7bfb3ec4 Merge pull request #1422 from t-woerner/ipauser_query
Ipauser query
2026-07-10 00:12:10 -03:00
Thomas Woerner
5e057cfbcd test_group_case_insensitive.yml: Fix wrong user absent task
The task used a users dict with name, first and last name given
and state:absent. This combination does not make sense and was
silenty ignored before by ipauser module.
2026-07-09 13:53:24 +02:00
Thomas Woerner
fcf4a60de6 ipauser: Use PARAM_MAPPING and query state support
The ipauser module has been reworked to use the new PARAM_MAPPING added
to ansible_freeipa_module.

The member handling for manager, principal, certificate and certmapdata
has been simplified by using gen_member_add_del_lists. The member
entries in PARAM_MAPPING are now marked with "member": True. This
replaces the manual calls to gen_add_del_lists, gen_add_list and
gen_intersection_list across three separate action/state branches with
a single unified call.

The new query state allows to retrieve user information from IPA.
The query_param option controls which fields are returned: BASE for
essential fields, ALL for all fields, PKEY_ONLY for user names only,
or a list of specific field names.

Here is the updated documentation of the module:

    README-user.md

New tests for the query state can be found at:

    tests/user/test_user_query.yml
2026-07-09 13:53:16 +02:00
Thomas Woerner
964345aed8 ansible_freeipa_module.py: New PARAM_MAPPING and query support
New functions and methods have been added to reduce code complexity
and duplication in several modules, as well as to enable query mode
in the modules.

New functions:

    gen_member_add_del_lists
        Compute member add/del lists for all member params marked with
        "member": True in PARAM_MAPPING. Handles sync, add-only and
        remove-only modes based on action and state.

    gen_member_args_from_mapping
        Build a member args dict for compare_args_ipa() from
        PARAM_MAPPING. Replaces per-module gen_member_args() functions.

New static methods:

    gen_args_from_mapping
        Generate IPA command args dict from PARAM_MAPPING. Replaces
        per-module gen_args() functions.

    extract_params
        Extract parameter values from module params using PARAM_MAPPING.

    extract_params_from_entry
        Extract parameter values from a users/hosts dict entry using
        PARAM_MAPPING.

    build_query_param_settings
        Build query parameter settings from PARAM_MAPPING and
        QUERY_FIELDS for use with execute_query.

New methods:

    execute_query
        Execute query state for modules supporting state: query.

    _extract_query_fields
        Extract requested fields from a query result using the mapping.

The params_fail_used_invalid method has been extended to accept optional
params and param_mapping arguments for use with extracted params dicts.

PARAM_MAPPING is an ordered dict that maps Ansible parameter names to
their metadata. Each entry is a dict with optional keys:

    "api_name"      IPA attribute name if different from the Ansible
                    parameter name.
    "gen_args"      Set to False to exclude the parameter from
                    gen_args_from_mapping (used for members and
                    parameters handled separately).
    "member"        Set to True to include the parameter in
                    gen_member_add_del_lists and
                    gen_member_args_from_mapping.
    "module_param"  Set to True for top-level module parameters that
                    are not part of the entity (e.g. action, state,
                    query_param, users).
    "return_only"   Set to True for parameters that are only returned
                    by IPA and never sent (excluded from
                    gen_args_from_mapping).
    "nonempty_list" Set to True if an empty list value should not be
                    sent to IPA.
    "lowercase"     Set to True to lowercase values before comparison.
    "convert_to"    Conversion type for the parameter value
                    (e.g. "str", "int", "bool").

An empty dict {} means the Ansible name equals the IPA attribute name
and the parameter is included in gen_args_from_mapping with no special
handling.

For query support a QUERY_FIELDS dict is needed with "prefix" for the
grouping key in PKEY_ONLY results, "primary_key" for the IPA name
attribute and "base" for the list of essential field names returned by
default.
2026-07-09 13:52:21 +02:00
Thomas Woerner
12bbf74d52 setup.cfg: Set max-public-methods to 25
With the updates for PARAM_MAPPING in IPAAnsibleModule it is needed to
increase max public methods.
2026-06-23 12:57:15 +02:00
Thomas Woerner
432c0b75fc Update pre-commit repo versions, deactivate parseable for ansible-lint
ansible-lint was updated to v26.4.0, yamllint to v1.38.0 and pylint to
v4.0.6.

parseable was deactivated in .ansible-lint as this option is not
supported any more.
2026-06-23 12:57:15 +02:00
Rafael Guterres Jeffman
4f6575b30c Merge pull request #1418 from t-woerner/fix_ssh_public_key_tests_without_key_type_name
Fix SSH public key tests without key type name
2026-04-28 09:43:30 -03:00
Thomas Woerner
ad4b343c7e Fix SSH public key tests without key type name
The tests using SSH public tests without using the "ssh-" key type name
are failing with latest Fedora versions.

The missing "ssh-rsa" key type name for the ssh public keys has been
added.
2026-04-27 09:44:05 +02:00
Rafael Guterres Jeffman
62fd1551eb Merge pull request #1410 from t-woerner/infra_container_load_save
infra/image/shcontainer: New container_save and container_load
2026-02-12 09:36:23 -03:00
Thomas Woerner
fe2e65bd35 build-collection.sh: Rename base README.md to make it invisible for AAH
AAH and also Galaxy are automatically trying to render the base README.md
file in the collection even if "readme" is set to another file in galaxy.yml.

Fixes:
1) README.md is renamed to README-COLLECTION.md
2) New README.md is generated with information about the rename and also
   pointing to the README-COLLECTION.md file in the collection and also
   the upstream documentation (versioned and latest).
3) Upstream "documentation" in galaxy.yml set to new README.md file.
2026-02-10 12:00:37 +01:00
Thomas Woerner
a24e90ad0c infra/image/shcontainer: New container_save and container_load
The new container_save and container_load functions can be used to
save and load container images.

container_save
    Save a container image to a local file.
    Example: container_save "${name}"

container_load
    Load a container image from an tar archive.
    Example: local_image=$(container_load "${archive}")
2026-02-09 15:37:26 +01:00
Rafael Guterres Jeffman
0b9718b3ec Merge pull request #1409 from t-woerner/utils_build_collection_command
Reworked and renamed script to generate Ansible collections
2026-01-22 08:54:35 -03:00
Thomas Woerner
226b8c4d75 Reworked and renamed script to generate Ansible collections
The script utils/build-galaxy-release.sh has been renamed to
utils/build-collection.sh, the script provides the same options, but
requires an extra argument now:

    build-collection.sh [options] rpm|aah|galaxy

The namespace and name are defined according to the argument:

    rpm     freeipa.ansible_freeipa   - General use and RPMs
    galaxy  freeipa.ansible_freeipa   - Ansible Galaxy
    aah     redhat.rhel_idm           - Ansible AutomationHub

The generated file README-COLLECTION.md is set in galaxy.yml as the
documentation entry point for the collections generated with aah and galaxy
as Ansible AutomationHub and also Ansible Galaxy are not able to render the
documentation README files in the collection properly.

The commit also changes the calls of utils/build-galaxy-release.sh to
utils/build-collection.sh.
2026-01-20 13:07:24 +01:00
Thomas Woerner
2f34e1ac6a Merge pull request #1407 from rjeffman/ipaserver_firewalld_warning
Fix Ansible warnings in Firewall zone testing tasks
v1.16.0
2026-01-09 17:44:55 +01:00
Thomas Woerner
e4ea7c8983 Merge pull request #1382 from rjeffman/ipadnsrecord_a_rec_create_reverse
ipadnsrecord: Allow setting any IP address if create_reverse is false
2026-01-09 13:43:44 +01:00
Rafael Guterres Jeffman
b3f024869c Fix Ansible warnings in Firewalld zone testing tasks
The firewalld zone verification tasks in ipaserver, ipareplica, and
ipabackup roles were triggering Ansible warnings due to variable
ipareplica_firewalld_zone not being defined when evaluating the task
name.

This fix remove the Jinja template from the task names and wrap the
tasks in a single block so the variable verification is done only once.

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2026-01-08 15:24:07 -03:00
Rafael Guterres Jeffman
355438cea9 ipadnsrecord: Allow setting any IP address if create_reverse is false
Adding an A/AAAA record to a host fails if there's not a reverse zone
set that the resulting PTR record can be added to, even if
create_reverse is false.

Changing the rule to create the reverse record fixes the issue.

Fixes: #1381

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2026-01-08 10:18:46 -03:00
Thomas Woerner
30b72422d9 Merge pull request #1372 from rjeffman/passkey_support
Add support for passkey
2026-01-07 20:22:46 +01:00
Thomas Woerner
10a84429e2 Merge pull request #1394 from rjeffman/pre-commit-update
pre-commit: Update pre-commit repo versions
2026-01-07 18:12:09 +01:00
Rafael Guterres Jeffman
bf384ab1aa New passkeyconfig management module
There is a new paskeyconfig management module placed in the plugins
folder:

    plugins/modules/ipapasskeyconfig.py

The paskeyconfig module allows to retrieve and modify global passkey
configuration attributes.

Here is the documentation of the module:

    README-passkeyconfig.md

New example playbooks have been added:

    playbooks/passkeyconfig/passkeyconfig-retrieve.yml
    playbooks/passkeyconfig/passkeyconfig-present.yml

New tests for the module can be found at:

    tests/passkeyconfig/test_passkeyconfig.yml
    tests/passkeyconfig/test_passkeyconfig_client_context.yml

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2026-01-07 11:13:32 -03:00
Rafael Guterres Jeffman
536b7cb5f3 ipauser: Add support for 'passkey' in 'user_auth_type'
The value 'passkey' was missing as a valid value for user_auth_type
attribute.

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2026-01-07 11:13:16 -03:00
Rafael Guterres Jeffman
17b100baec ipaservice: Add support for 'passkey' in 'auth_ind'
The value 'passkey' was missing as a valid value for auth_ind attribute.

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2026-01-07 11:13:16 -03:00
Rafael Guterres Jeffman
1488fb7b5e ipahost: Add support for 'passkey' in 'auth_ind'
The value 'passkey' was missing as a valid value for auth_ind attribute.

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2026-01-07 11:13:16 -03:00
Rafael Guterres Jeffman
a733c031b0 ipaconfig: Add support for 'passkey' in 'user_auth_type'
The value 'passkey' was missing as a valid value for user_auth_type
attribute.

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2026-01-07 11:13:16 -03:00
Rafael Guterres Jeffman
ff1a026ef4 tests: Add fact for passkey support
When testing passkey attributes some version of IPA do not support it,
se we need a fact that states that the support is available for proper
testing.

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2026-01-07 11:13:16 -03:00
Rafael Guterres Jeffman
fa5d056e72 Merge pull request #1398 from t-woerner/sysaccount
Sysaccount management
2026-01-05 14:45:44 -03:00
Rafael Guterres Jeffman
e0e3cb041e Merge pull request #1405 from t-woerner/cert_new_invalid_profile_message
Cert tests: Do not fail on new dogtag profile not found error message
2026-01-05 14:38:24 -03:00
Thomas Woerner
b54aaf127d README-role.md: Fix typo in action description
There was a typo in the description for action.
2026-01-05 18:22:44 +01:00
Thomas Woerner
4e16126b29 iparole: Add sysaccount member support
sysaccounts can now be used as a member for roles.

Example:

  - name: Ensure role my-app role has sysaccount member my-app
    iparole:
      name: my-app role
      sysaccount: my-app
      action: member

New tests for the module:

    tests/role/test_role_sysaccount_member.yml
2026-01-05 18:22:37 +01:00
Thomas Woerner
ed62c2f1bf Cert tests: Do not fail on new dogtag profile not found error message
The error message for an invalid profile has changes in dogtag. The new
message is "Certificate operation cannot be completed: Unable to get
enrollment template for <profile name>: Profile not found"

Therefore the test is additionally checking for "Profile not found" now.
2026-01-05 16:39:07 +01:00
Thomas Woerner
dc9b0ce4e8 New sysaccount management module
There is a new sysaccount management module placed in the plugins folder:

    plugins/modules/ipasysaccount.py

The sysaccount module allows to ensure presence or absence of system
accounts.

Here is the documentation for the module:

    README-sysaccount.md

New sysaccount example playbooks:

    playbooks/sysaccount/sysaccount-absent.yml
    playbooks/sysaccount/sysaccount-disabled.yml
    playbooks/sysaccount/sysaccount-enabled.yml
    playbooks/sysaccount/sysaccount-present.yml
    playbooks/sysaccount/sysaccount-privileged.yml
    playbooks/sysaccount/sysaccount-unprivileged.yml

New tests for the module:

    tests/sysaccount/test_sysaccount.yml
    tests/sysaccount/test_sysaccount_client_context.yml
2026-01-05 16:36:26 +01:00
Thomas Woerner
aa3bf1f015 Merge pull request #1406 from rjeffman/fix_checkpr_version_name
upstream ci: Use version_name for CheckPR labels
2026-01-05 16:35:23 +01:00
Rafael Guterres Jeffman
f0aa531b28 upstream ci: Use version_name for CheckPR labels
As the ansible_version variable may contain a version specification, we
need a version_name to correctly report the job label in Azure.

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2026-01-05 12:01:15 -03:00
Thomas Woerner
6407fd8b2e Merge pull request #1404 from rjeffman/fix_pipeline_names
upstream ci: Fix Azure pipelines invalid names
2025-11-27 10:43:01 +01:00
Rafael Guterres Jeffman
2a1be13d3e upstream ci: Fix Azure pipelines invalid names
Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2025-11-24 13:25:26 -03:00
Thomas Woerner
2afca1fa5e Merge pull request #1403 from rjeffman/checkpr_ansible_version
upstream CI: Fix CheckPR ansible-core version definition
2025-11-24 11:23:44 +01:00
Thomas Woerner
2a40e42b0c Merge pull request #1402 from rjeffman/fix_nightlies
upstream CI: Fix nightly and azure-pipelines to use version map
2025-11-24 11:23:11 +01:00
Rafael Guterres Jeffman
8a33941188 upstream CI: Fix CheckPR ansible-core version definition
By using the 'ansible-version' variable as '<2.17' allows 'pip' to
install the latest version of the 2.16 series, instead of version 2.16.0
in the case '==2.16'. This ensures we run the tests with the latest
supported version for the specific distro.

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2025-11-21 09:33:47 -03:00
Rafael Guterres Jeffman
0aef995bbe upstream CI: Fix Azure nightly pipelines to use version map
Modify nigtly pipelines to use the same distro-to-Ansible version map
so that the Ansible version matches the required version for the
specific distro. Nightly pipelines are the same used for Weekly tests.

This was required due to recent updates for Python 3.14 and Ansible
upstream versions.

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2025-11-21 09:25:08 -03:00
Rafael Guterres Jeffman
e75efb7a13 pre-commit: Update pre-commit repo versions
ansible-lint version series 24.y is not working with ansible-core 2.19 and
requires versions in series 25.y. Also, other tools were update to more
recent versions.

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2025-11-11 15:11:20 -03:00
Thomas Woerner
ed44344519 Merge pull request #1380 from rjeffman/python_requirements
Fixes several linter issues for recent tool versions.
2025-11-11 13:04:51 +01:00
Rafael Guterres Jeffman
b186a1f28f upstream CI: Update Ansible version for c9s
Although the available ansible-core package version for c9s is 2.14, the
upstream "pip" version of this package has a broken certificate and is
unusable against Galaxy.

This patch fixes the version to 2.16, as it is the same version for c8s
and c10s, and the oldest one available as packages for the CentOS
Streams.

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2025-11-10 15:48:26 -03:00
Rafael Guterres Jeffman
d307635c38 pytest: update to work with recent Python
With Python 3.14, the required pytest version stopped working due to
breaking changes in AST.

This patch changes the test tool versions to the most recent one, by
requiring only the minimal version, but not setting a specific one.
Recent pytest version also requires that the search path for Python
modules is defined.

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2025-11-10 15:39:00 -03:00
Thomas Woerner
74f3817531 Merge pull request #1377 from rjeffman/ansible_2_18
Update Ansible version in Upstream CI
2025-11-10 15:39:41 +01:00
Rafael Guterres Jeffman
97378c38cf pylint: Add list of upper case constants to setup.cfg
Pylint 4.0.1 seems to not understand that some of the constants used by
ansible-freeipa roles and modules are constants and not variables, and
complain about the naming style.

By adding these constant names to the "good-names" list avoid pylint
errors and don't require future unnecessary changes.

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2025-11-10 11:38:52 -03:00