我有相当广泛的盐配置,我希望能够看到发生了什么变化。如果我只是运行,salt '*' state.highstate
我会得到整个列表,其中包含存在且未更改的内容 - 例如 3 到 4 个日志屏幕。但我真的很想只看到在上一份工作中发生变化的事情。
它不必为盐调用工作,它也可以使用salt-run jobs.lookup_jid
.
我有相当广泛的盐配置,我希望能够看到发生了什么变化。如果我只是运行,salt '*' state.highstate
我会得到整个列表,其中包含存在且未更改的内容 - 例如 3 到 4 个日志屏幕。但我真的很想只看到在上一份工作中发生变化的事情。
它不必为盐调用工作,它也可以使用salt-run jobs.lookup_jid
.
我们还添加state_output: mixed
了它将为您提供与 相同的输出terse
,除非出现故障,在这种情况下,它将为您提供更详细的输出。
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
<...>
There are 2 options, first is to change the state_output in master's configuration file, like mentioned in the accepted answer, and it also possible to override the state output in command line, like:
salt --state-output=mixed \* test.version
从以下合并到 Salt 2015.8.0 ( https://github.com/saltstack/salt/pull/26962 ) 的 PR 开始,现在可以state_verbose
在运行 highstate 时从命令行切换标志。这会覆盖您可以/etc/salt/master
在之前的答案中提到的配置。
以下命令现在应该只显示来自 highstate 运行的更改和错误salt '*' state.highstate --state-verbose=False
您可以使用以下内容将输出缩短为一行,然后过滤该输出以仅显示更改:
salt -v 'minion' state.highstate test=True --state-output=terse --state-verbose=False