Is there a way to display only changes and errors

To actually answer the question, yes, there is an output filter for changes only:

salt '*' state.highstate --state-output=changes

This will display one liners for things that are in the right state and the proper output for the changes. ie:

  <...>
  Name: /etc/sudoers - Function: file.managed - Result: Clean
  Name: /etc/timezone - Function: file.managed - Result: Clean
  Name: /etc/pki/tls/certs/logstash-forwarder.crt - Function: file.managed - Result: Clean
  Name: /etc/init.d/logstash-forwarder - Function: file.managed - Result: Clean
----------
          ID: /etc/logstash-forwarder
    Function: file.managed
      Result: True
     Comment: File /etc/logstash-forwarder updated
     Started: 14:14:28.580950
    Duration: 65.664 ms
     Changes:
              ----------
              diff:
                  ---
                  +++
                  @@ -1,6 +1,6 @@
                   {
                     "network": {
                  -    "servers": [ "10.0.0.104:5000" ],
                  +    "servers": [ "10.0.0.72:5000" ],
                       "timeout": 15,
                       "ssl ca": "/etc/pki/tls/certs/logstash-forwarder.crt"
                     },

  Name: deb http://packages.elasticsearch.org/logstashforwarder/debian stable main - Function: pkgrepo.managed - Result: Clean
  Name: logstash-forwarder - Function: pkg.installed - Result: Clean
  <...>

You can set state_verbose: False in /etc/salt/master or /etc/salt/minion. If you want to shorten the output to one line per state, set state_output: terse.

You can also pass these filters on command line:

salt --state-output=terse '*' state.highstate

If you only want to see changes, you can use state-output=changes or state-output=mixed. The latter one will show more information on a failure.

See the following answers fore more detail: basepi, psarossy


We've also added state_output: mixed which will give you the same output as terse, except if there's a failure, in which case it will give you the more verbose output.

Tags:

Salt Stack