Commit Graph

1406 Commits

Author SHA1 Message Date
Rafael Guterres Jeffman
26ac5a284a setup.py: Disable pylint rule import-error.
When running pylint against 'setup.py' it warns that an import is
not used. While it is not directly used, this is a fix for an issue
with older versions of Python, so this change tells pylint to ignore
the error.
2021-09-29 15:52:30 -03:00
Rafael Guterres Jeffman
926297f855 Merge pull request #649 from t-woerner/playbooks_fix_exmaple
playbooks, README-host: Change exmaple to example
2021-09-29 09:09:03 -03:00
Thomas Woerner
b62735ede2 Merge pull request #646 from rjeffman/iparole_fix_test
tests: Fix facts for iparole tests.
2021-09-29 10:29:49 +02:00
Thomas Woerner
ffe8a121dd playbooks, README-host: Change exmaple to example
This changes exmaple to example.
2021-09-29 10:09:43 +02:00
Thomas Woerner
8fe41495a0 Merge pull request #631 from rjeffman/plugins_remote_module_execution
Remote module execution
2021-09-29 09:51:47 +02:00
Rafael Guterres Jeffman
7e0624d836 ipavault: Allow execution of plugin in client host.
Update vault README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/vault/test_vault_client_context.yml

As `ipavault` only works in client context, an error is raised if it
is explicitly executed in a server context.
2021-09-28 19:16:11 -03:00
Rafael Guterres Jeffman
d9dcc8f5dc topology: Allow execution of plugin in client host.
Update README-topology.md file with details on support for new variable
`ipaapi_context`.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
63423779a8 ipaselfservice: Allow execution of plugin in client host.
Update selfservice README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/selfservice/test_selfservice_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
f1381edcd4 ipaservice: Allow execution of plugin in client host.
Update service README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/service/test_service_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
27b50957d1 ipauser: Allow execution of plugin in client host.
Update user README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/user/test_user_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
577d8f7893 ipatrust: Allow execution of plugin in client host.
Update trust README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/trust/test_trust_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
829f10568a ipasudorule: Allow execution of plugin in client host.
Update sudorule README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/sudorule/test_sudorule_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
3cd9978171 ipasudocmdgroup: Allow execution of plugin in client host.
Update sudocmdgroup README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/sudocmdgroup/test_sudocmdgroup_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
198e2152f5 ipasudocmd: Allow execution of plugin in client host.
Update sudocmd README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/sudocmd/test_sudocmd_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
26dc8f1e53 ipaserver: Allow execution of plugin in client host.
Update server README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/server/test_server_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
c38b1e2539 iparole: Allow execution of plugin in client host.
Update role README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/role/test_role_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
d5451cdacb ipapwpolicy: Allow execution of plugin in client host.
Update pwpolicy README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/pwpolicy/test_pwpolicy_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
368cee9364 ipaprivilege: Allow execution of plugin in client host.
Update privilege README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/privilege/test_privilege_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
a599f4ad87 ipapermission: Allow execution of plugin in client host.
Update permission README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/permission/test_permission_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.

Due to differences in data returned when running in a client context,
some values had to be modified so that comparision works and an
unnecessary call to IPA API is executed.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
1440fb39b2 ipalocation: Allow execution of plugin in client host.
Update location README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/location/test_location_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
40f544bab4 ipahostgroup: Allow execution of plugin in client host.
Update hostgroup README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/hostgroup/test_hostgroup_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
d0287f90cd ipahost: Allow execution of plugin in client host.
Update host README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/host/test_host_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
6ce1055bac ipahbacsvcgroup: Allow execution of plugin in client host.
Update hbacsvcgroup README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/hbacsvcgroup/test_hbacsvcgroup_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
ec777dab8f ipahbacsvc: Allow execution of plugin in client host.
Update hbacsvc README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/hbacsvc/test_hbacsvc_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
876187ab85 ipahbacrule: Allow execution of plugin in client host.
Update hbacrule README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/hbacrule/test_hbacrule_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
1fdf7a4359 ipagroup: Allow execution of plugin in client host.
Update group README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/group/test_group_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
cf7b197a1f ipadnszone: Allow execution of plugin in client host.
Update dnszone README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/dnszone/test_dnszone_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.

Due to differences in data returned when running in a client context,
verification if zone is active had to be modified.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
a834de1f95 ipadnsrecord: Allow execution of plugin in client host.
Update dnsrecord README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/dnsrecord/test_dnsrecord_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
da45d74f75 ipadnsforwardzone: Allow execution of plugin in client host.
Update dnsforwardzone README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/dnsforwardzone/test_dnsforwardzone_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.

Due to differences in data returned when running ipadnsforwardzone in
a client context, some values had to be modified so that comparision
works, avoiding unnecessary IPA API calls.
2021-09-28 10:19:43 -03:00
Rafael Guterres Jeffman
393cb8ba82 ipadnsconfig: Allow execution of plugin in client host.
Update dnsconfig README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/dnsconfig/test_dnsconfig_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:42 -03:00
Rafael Guterres Jeffman
638977e0b8 ipadelegation: Allow execution of plugin in client host.
Update delegation README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/delegation/test_delegation_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:42 -03:00
Rafael Guterres Jeffman
65271a018d ipaconfig: Allow execution of plugin in client host.
Update config README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/config/test_config_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.

As the tests for ipaconfig may render the server in an inconsistent
state if they fail, the tests in tests/config/test_config.yml were
wrapped in a way that if one test fails, the default FreeIPA
configuration is restored to the server.
2021-09-28 10:19:42 -03:00
Rafael Guterres Jeffman
e4d2b62bdb ipaautomountlocation: Allow execution of plugin in client host.
Update automountlocation README file and add tests for executing plugin
with `ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/automountlocation/test_automountlocation_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-28 10:19:42 -03:00
Rafael Guterres Jeffman
4fda36eb7d tests: Fix facts for iparole tests.
This patch fixes setting ipaserver_domain and ipaserver_realm facts for
iparole tests, fixing variable evaluation and allowing the tests to be
executed even if `gather_facts: no`.
2021-09-27 15:36:29 -03:00
Rafael Guterres Jeffman
e6ecae0d4b ipaautomember: Allow execution of plugin in client host.
Update automember README file and add tests for executing plugin with
`ipaapi_context` set to `client`.

A new test playbook can be found at:

    tests/automember/test_automember_client_context.yml

The new test file can be executed in a FreeIPA client host that is
not a server. In this case, it should be defined in the `ipaclients`
group, in the inventory file.
2021-09-27 13:51:53 -03:00
Rafael Guterres Jeffman
aa6c5c610b tests: Create IPA fact ipa_host_is_client.
This patch adds a new fact `ipa_host_is_client`, available in the
include task file `env_freeipa_facts.yml`.

The variable `ipa_host_is_client` is set to TRUE if the client host
is not an IPA server (primary or replica). It can be used if a test
cannot be executed in a server, independent of the value set to
`ipaapi_context`.
2021-09-27 13:51:53 -03:00
Rafael Guterres Jeffman
1c679c5a9a templates: Allow execution of plugins in an IPA client host.
Modify templates to create the basic tests for `ipaapi_context: client`.
2021-09-27 13:51:53 -03:00
Rafael Guterres Jeffman
8bc6b01f49 modules: Allow execution of plugins in an IPA client host.
Add a new configuration variable, `ipaapi_context` to IPAAnsibleModule
base specs, accepting only 'server' or 'client' values.

By using this variable, an user can select the environment context in
which the module will execute, server or client. This change will allow
configuration of the server without requiring login access (e.g. `ssh`)
to the server.

The default behavior is to use a `server` context, but this behavior
can be modified by the plugin, if it sets the `context` parameter when
connecting to IPA API.
2021-09-27 13:51:53 -03:00
Rafael Guterres Jeffman
3fefaadff4 Merge pull request #643 from t-woerner/ipaclient_nss_nosssd_files
ipaclient_setup_nss: Use proper nosssd_files list
2021-09-25 19:25:12 -03:00
Thomas Woerner
116398608f Merge pull request #635 from rjeffman/ipaconfig_tests
ipaconfig: Prevent configuration issues due to test failure.
2021-09-24 15:13:35 +02:00
Thomas Woerner
bc37d49947 Merge pull request #641 from rjeffman/ipaserver_fix_hardcoded_name_test
ipaserver: Allow configuration of test server name.
2021-09-24 15:10:39 +02:00
Thomas Woerner
60ff782a7e ipaclient_setup_nss: Use proper nosssd_files list
ipaclient_setup_nss is using the nosssd_files dict if sssd is disabled
with no_sssd.

The nosssd_files dict is generated in ipaclient_test and used in
ipaclient_setup_nss. So far ipaclient_setup_nss was using nosssd_files
from ipaclient installer, which was always None.
2021-09-23 13:21:13 +02:00
Rafael Guterres Jeffman
076835e008 ipaserver: Allow configuration of test server name.
As the server name was hard coded, when running tests for ipasever
module using a server not name as 'ipaserver', the tests would fail.

This patch allows the configuration of the server name using the
variable 'ipa_server_name', and if not provided, try to infer the name
from the ansible_hostname variable, or, if not possible, defaults to
'ipaserver'.

The same behavior is applied to 'ipasever_domain', with the default
being 'ipa.test'.
2021-09-20 11:05:03 -03:00
Rafael Guterres Jeffman
97670e8e46 Merge pull request #640 from t-woerner/group_class_fixes
group: Fix nonposix, posix and external handling and conversions
2021-09-16 16:55:25 -03:00
Rafael Guterres Jeffman
a5fa3d862a ipaconfig: Prevent configuration issues due to test failure.
Currently, if a test fails during execution of ipaconfig playbook
tests, or if the failed task is the task reverting to the original
configuration fails, the testing host might be left in a state that
may cause other tests to fail due to the inconsistent configuration
state.

This patch ensures that if a test fails, a known configuration, the
same as used is the default installation of FreeIPA used in upstream
CI, is applied to the host, providing safe environment for testing.
2021-09-16 11:29:30 -03:00
Thomas Woerner
1f25024396 group: Fix nonposix, posix and external handling and conversions
The nonposix, posix and external parameters need to be mutually
exclusive. external was missing in this list. Only one of the three
parameters can be used.

external can not be set to no/false. This results in an error now.

if nonposix is used, posix is set as not nonposix. The nonposix
parameter is not used within the code anymore..

New tests have been added to tests the addition of users with for
nonposix and posix groups. The tests for the external group is not
active due to the need of an AD.

Fixes: #528 (Error creating nonposix group)
2021-09-16 13:30:34 +02:00
Thomas Woerner
ccb07cbef5 Merge pull request #634 from rjeffman/sudocmd_use_execute_ipa_commands
Use execute_ipa_commands for sudocmd plugins.
2021-09-16 11:14:29 +02:00
Thomas Woerner
3d6bf87187 Merge pull request #637 from rjeffman/ipaconfig_missing_params
config: Fix data returned from module.
2021-09-16 10:20:53 +02:00
Rafael Guterres Jeffman
87de471d97 config: Fix data returned from module.
When retrieving IPA configuration using ipaconfig module, a few
variables were not returning, and some data had the wrong data format.

This patch fix both issues and apply some refactoring, as data was
being retrieved from IPA API in different places using different
methods.
2021-09-15 08:53:39 -03:00
Thomas Woerner
2da03cb836 Merge pull request #639 from rjeffman/ipaconfig_remove_unused_code
config: Remove unused code.
2021-09-15 11:42:42 +02:00