From cf66c8a2497e59a35b59e862b55a0bcd4ac9856e Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 21:46:23 +0300 Subject: [PATCH] [PR #8900/a32f1d69 backport][stable-8] ipa_hostgroup: fix state params (#8905) ipa_hostgroup: fix state params (#8900) * Fix ipa_hostgroup * Add CHANGELOG fragment (cherry picked from commit a32f1d699bffac90a4cbe11cb5c11a0851a6666e) Co-authored-by: alexander <79072457+abakanovskii@users.noreply.github.com> --- changelogs/fragments/8900-ipa-hostgroup-fix-states.yml | 2 ++ plugins/modules/ipa_hostgroup.py | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/8900-ipa-hostgroup-fix-states.yml diff --git a/changelogs/fragments/8900-ipa-hostgroup-fix-states.yml b/changelogs/fragments/8900-ipa-hostgroup-fix-states.yml new file mode 100644 index 0000000000..c7347e879f --- /dev/null +++ b/changelogs/fragments/8900-ipa-hostgroup-fix-states.yml @@ -0,0 +1,2 @@ +bugfixes: + - ipa_hostgroup - fix ``enabled `` and ``disabled`` states (https://github.com/ansible-collections/community.general/issues/8408, https://github.com/ansible-collections/community.general/pull/8900). diff --git a/plugins/modules/ipa_hostgroup.py b/plugins/modules/ipa_hostgroup.py index 70749c35b3..9e6abf32aa 100644 --- a/plugins/modules/ipa_hostgroup.py +++ b/plugins/modules/ipa_hostgroup.py @@ -57,13 +57,14 @@ options: state: description: - State to ensure. + - V("absent") and V("disabled") give the same results. + - V("present") and V("enabled") give the same results. default: "present" choices: ["absent", "disabled", "enabled", "present"] type: str extends_documentation_fragment: - community.general.ipa.documentation - community.general.attributes - ''' EXAMPLES = r''' @@ -160,7 +161,7 @@ def ensure(module, client): module_hostgroup = get_hostgroup_dict(description=module.params['description']) changed = False - if state == 'present': + if state in ['present', 'enabled']: if not ipa_hostgroup: changed = True if not module.check_mode: