diff --git a/changelogs/fragments/fix_rule_conditions_missing.yml b/changelogs/fragments/fix_rule_conditions_missing.yml new file mode 100644 index 000000000..341b85838 --- /dev/null +++ b/changelogs/fragments/fix_rule_conditions_missing.yml @@ -0,0 +1,2 @@ +bugfixes: + - Rule module - Fix empty rule conditions. diff --git a/plugins/modules/rule.py b/plugins/modules/rule.py index a446c98a2..238dbd8cd 100644 --- a/plugins/modules/rule.py +++ b/plugins/modules/rule.py @@ -583,7 +583,7 @@ def run_module(): if not rule.get("value_raw"): exit_failed(module, "Rule value_raw is required") # Default to all hosts if conditions arent given - if rule.get("conditions"): + if not rule.get("conditions"): rule["conditions"] = { "host_tags": [], "host_labels": [],