admin管理员组

文章数量:1296907

I'm new to SaltStack and would like to know if there's a solution to a problem I have that follows "best practices."

I have something like this snippet in an orchestrator, waiting for a specific event to be available on the event bus.

trigger_some_slow_process:
  salt.state:
    - sls: start_slow_process

#Wait for expected event when target state is reached.
wait_for_some_event:
  salt.wait_for_event:
    - name: some/status/crashed/{{important_value}}/final
    - timeout: 300  # Maximum time (in seconds) to wait for the event
    - require:
      - salt: trigger_some_slow_process

I'd like to include some extra information in the event and access the attributes. I would think this is possible since it's not unusual for an event to have several attributes. The event is dispatched from a beacon. I think it'll be more anized if I could access the attributes and have it all in the orchestrator instead of jam-packing all of the attributes and parsing the event tag.

The problem is that if I don't match against that particular information, the event will not be unique.

Essentially I want to trigger some process, and a beacon is monitoring the process until a state is reached, so I can be alerted asynchronously. Once it completes, the beacon dispatches an event detecting the condition, and I want to receive the beacon event, and (on the orchestrator/ salt master) wait until the expected event is present.

In this particular case, I'd like to have the important_value in the event data, instead of stuffing it in the event tag.

Is it possible to use a reactor to put the values in a pillar? I'd like the wait to be inside the orchestrator, since otherwise I'm going to have a lot of short files, making maintaining and understanding the flow of tasks more difficult.

Is there a way to handle this elegantly in SaltStack?

I'm new to SaltStack and would like to know if there's a solution to a problem I have that follows "best practices."

I have something like this snippet in an orchestrator, waiting for a specific event to be available on the event bus.

trigger_some_slow_process:
  salt.state:
    - sls: start_slow_process

#Wait for expected event when target state is reached.
wait_for_some_event:
  salt.wait_for_event:
    - name: some/status/crashed/{{important_value}}/final
    - timeout: 300  # Maximum time (in seconds) to wait for the event
    - require:
      - salt: trigger_some_slow_process

I'd like to include some extra information in the event and access the attributes. I would think this is possible since it's not unusual for an event to have several attributes. The event is dispatched from a beacon. I think it'll be more anized if I could access the attributes and have it all in the orchestrator instead of jam-packing all of the attributes and parsing the event tag.

The problem is that if I don't match against that particular information, the event will not be unique.

Essentially I want to trigger some process, and a beacon is monitoring the process until a state is reached, so I can be alerted asynchronously. Once it completes, the beacon dispatches an event detecting the condition, and I want to receive the beacon event, and (on the orchestrator/ salt master) wait until the expected event is present.

In this particular case, I'd like to have the important_value in the event data, instead of stuffing it in the event tag.

Is it possible to use a reactor to put the values in a pillar? I'd like the wait to be inside the orchestrator, since otherwise I'm going to have a lot of short files, making maintaining and understanding the flow of tasks more difficult.

Is there a way to handle this elegantly in SaltStack?

Share Improve this question asked Feb 11 at 22:27 joshuarjoshuar 1872 silver badges10 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

orchestration knows nothing about events. salt.wait_for_events is a module and only tracks the tags and the id information.

as for what the reactor can do. the reactor can put the info in an inline pillar.

like

the reactor example:
  runner.state.orch:
    - mod: stage2
    - pillar:
        tag: {{tag}}
        event: {{ data |json}}

that will at least make orchestration aware of the event information.

本文标签: salt projectSaltstack Waiting for event in orchestrator with specific attributesStack Overflow