Rule template

Its possible to create basic rule templates that will ask just for enough information to work, filling out all the required automation rule.

They may require to fill a service or some related information in a form.

Manifest YAML component definition

- name: Server socket is up
  description: |
    Checks every 5m/ 10m grace if the server socket is up,
    and sets labels according to changes.
  id: rule.socket.is_up
  type: rule template
  traits: url
  fields:
    - id: service
      type: service
      traits: url
  rule:
    when:
      id: when
      trigger: socket.is_up
      params:
        url: ""
        frequency: 5m
        grace: 10m
    actions:
      - type: condition
        condition:  changes.when.up == true
        then:
          - type: action
            action: serverboards.core.actions/set-tags
            params:
              service: 
              tags: UP -DOWN
      - type: condition
        condition:  changes.when.up == false
        then:
          - type: action
            action: serverboards.core.actions/set-tags
            params:
              service: 
              tags: -UP DOWN
Field Description
type rule type
traits Required traits at service
fields generic form data to fill
rule rule v2 that will be pre templated with the data from the form

The rule must follow the rules schema, and must use templated data for the fields it require from the fields field. These fields will be pretemplated before starting the rule. Other data that the rule generates may be used in later stages without any problem, for example in templated emails.

If there are fields of the service type, they will be augmented with the full service data.