ansible-rulebook icon indicating copy to clipboard operation
ansible-rulebook copied to clipboard

Support for standalone Booleans in conditions

Open AssafKatz3 opened this issue 1 year ago • 6 comments

Please confirm the following

  • [X] I agree to follow this project's code of conduct.
  • [X] I have checked the current issues for duplicates.
  • [X] I understand that ansible-rulebook is open source software provided for free and that I might not receive a timely response.

Feature type

Enhancement to Existing Feature

Feature Summary

This helps when we want to print events, process all messages in Kafka topic without knowing the contents of the event. The literal boolean true allows the condition to pass and the action various action can be done for events.

Steps to reproduce

- name: print event always
  condition: true
  action:
    print_event:
      pretty: true

Current results

Cannot be done

Sugested feature result

Can be passed

Additional information

See this pull request

AssafKatz3 avatar Mar 15 '23 07:03 AssafKatz3

Hello. To print all the events you can use the flag --print-events

Alex-Izquierdo avatar Mar 15 '23 09:03 Alex-Izquierdo

Hello. To print all the events you can use the flag --print-events

Hi, This is an example simpler than reading Kafka topic 😊

AssafKatz3 avatar Mar 15 '23 09:03 AssafKatz3

So I think we can close this feature request because it's already implemented.

Alex-Izquierdo avatar Mar 15 '23 09:03 Alex-Izquierdo

@Alex-Izquierdo I need it for a Kafka topic so it wasn't implemented as far as I know.

AssafKatz3 avatar Mar 15 '23 10:03 AssafKatz3

The feature as it is described is going to be rejected because can not be implemented. The condition must contains always a query about the event data, this how works and was designed the rule engine.

The usecase of printing all the events is already supported with the flag --print-events.

Alex-Izquierdo avatar Mar 15 '23 10:03 Alex-Izquierdo

The feature as it is described is going to be rejected because can not be implemented. The condition must contains always a query about the event data, this how works and was designed the rule engine.

Hi, The use case is relevantly simple:

  1. We have a Kafka topic with messages to be routed
  2. The routes and related information (action to do over data) are written in a database
  3. I want to use ansible-rulebook since our team knows Ansible well
  4. The messages have different structures and the routing depends on multi parameters
  5. I have a few rules (different Kafka topics and maybe webhook)

Therefore while filtering is ultimately dependent on event data, it requires features that aren't available in ansible-rulebook (unless you code them in Python...) so the condition doesn't meet our requirements.

AssafKatz3 avatar Mar 15 '23 12:03 AssafKatz3