Open jelion opened 1 month ago
Files identified in the description:
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.
cc @Akasurde @Nosmoht @justchris1 click here for bot help
Summary
The module 'ipa_hostgroup' documents that its 'state' parameter accepts 4 values: 'absent', 'disabled', 'enabled', and 'present'.
However, when 'disabled' or 'enabled' is passed in, the hostgroup does not get created. (In fact, the hostgroup gets deleted if it exists!)
Looking at the code in this repository, it is obvious: in the 'ensure' function, the code only checks "if state == 'present'" around line 163; when 'enabled' or 'disabled' is passed in, the "delete hostgroup" if branch gets taken! (In the similar ipa_hbacrule module, the test at the equivalent point in code is a membership test - "if state in ['present', 'enabled', 'disabled']
It seems to me that hostgroups are not something that are enabled or disabled, so it is possible the correct action is to not accept those values. However, I realize that could create version compatibility issues; if it does accept 'enabled' and 'disabled', , then an enabled or disabled hostgroup should probably get created!
Issue Type
Bug Report
Component Name
ipa_hostgroup
Ansible Version
Community.general Version
Configuration
OS / Environment
RHEL 8
Steps to Reproduce
Expected Results
When I ran the playbook shown above, I expected the hostgroup to get created. It did not. "ipa hostgroup-find testhostgroup" returned zero results.
When I changed the playbook to use state='present', the hostgroup was created as expected.
When I changed it back to 'enabled' and ran it again, the hostgroup I had just created with 'present' was deleted! I certainly did not expect that!
Actual Results
Code of Conduct