salt.states.event

Send events through Salt's event system during state runs

salt.states.event.fire_master(name, data=None, preload=None, with_env=False, with_grains=False, with_pillar=False, show_changed=True, **kwargs)

This function is an alias of send.

Send an event to the Salt Master

New in version 2014.7.0.

Accepts the same arguments as the event.send execution module of the same name, with the additional argument:

param show_changed:

If True, state will show as changed with the data argument as the change value. If False, shows as unchanged.

Example:

# ...snip bunch of states above

mycompany/mystaterun/status/update:
  event.send:
    - data:
        status: "Half-way through the state run!"

# ...snip bunch of states below
salt.states.event.mod_watch(name, data=None, preload=None, with_env=False, with_grains=False, with_pillar=False, show_changed=True, **kwargs)

This function is an alias of send.

Send an event to the Salt Master

New in version 2014.7.0.

Accepts the same arguments as the event.send execution module of the same name, with the additional argument:

param show_changed:

If True, state will show as changed with the data argument as the change value. If False, shows as unchanged.

Example:

# ...snip bunch of states above

mycompany/mystaterun/status/update:
  event.send:
    - data:
        status: "Half-way through the state run!"

# ...snip bunch of states below
salt.states.event.send(name, data=None, preload=None, with_env=False, with_grains=False, with_pillar=False, show_changed=True, **kwargs)

Send an event to the Salt Master

New in version 2014.7.0.

Accepts the same arguments as the event.send execution module of the same name, with the additional argument:

Parameters:

show_changed -- If True, state will show as changed with the data argument as the change value. If False, shows as unchanged.

Example:

# ...snip bunch of states above

mycompany/mystaterun/status/update:
  event.send:
    - data:
        status: "Half-way through the state run!"

# ...snip bunch of states below
salt.states.event.wait(name, sfun=None, data=None)

Fire an event on the Salt master event bus if called from a watch statement

New in version 2014.7.0.

Example:

# Stand up a new web server.
apache:
  pkg:
    - installed
    - name: httpd
  service:
    - running
    - enable: True
    - name: httpd

# Notify the load balancer to update the pool once Apache is running.
refresh_pool:
  event:
    - wait
    - name: mycompany/loadbalancer/pool/update
    - data:
        new_web_server_ip: {{ grains['ipv4'] | first() }}
    - watch:
      - pkg: apache