I am only using Saltstack to run commands on multiple servers, e.g. to check if a specific TYPO3 extension exists on any server. I want to suppress empty output of minions (i.e. the hostname) and want to see if a minion could not be reached.
Sample output of how it is at the moment:
serverA:
serverB:
serverC:
/var/www/vhosts/example.com/httpdocs/typo3conf/ext/news/ext_emconf.php: 'version' => '4.2.1',
serverD:
Sample output of how it should be (let's assume serverX is down):
serverC:
/var/www/vhosts/example.com/httpdocs/typo3conf/ext/news/ext_emconf.php: 'version' => '4.2.1',
serverX: is down!
Best Answer
Use output in one line (
--out txt
)salt --out txt '*' cmd.run 'if [ -f /tmp/xxx ];then echo 'hello';fi'
will output if file exists:
minion1: hello
will output nothing if file doesn't exist