Alexander
Alexander

Reputation: 91

pass pillar to reactor from a state

I have one orchestrator which applying some stuff on a bunch of minions. Also, have a reactor that is listening for a certain event to be returned from a state, "- fire_event: my custom tag". What I need is somehow to pass pillar data to the reactor from the state, is it possible at all?

Upvotes: 0

Views: 270

Answers (1)

whytewolf
whytewolf

Reputation: 704

The best method would be to include the pillar data in the event you are sending. If you are using event.send state to send the event, you can include with_pillar: true in the state, to include all pillar data. If you don't want to include all pillars, you can use jinja to render the pillars you do want into the data section.

event sending:
  event.send:
    - name: event/tag/like/normal
    - data:
        item1: {{salt["pillar.get"]('thing1')}}
        item2: {{salt["pillar.get"]('etc')}}

Things in data will be included in the event that gets to the reactor.

Upvotes: 1

Related Questions