Why SaltStack execution stack isn't well format?

78 Views Asked by At

Good morning guys,

For an internal project I use SaltStack to install in instance of an application. But when I execute my state, at the end of execution, the output isn't well format.

For exemple :

ID: change permission\x1b[0;0m\n    \x1b[0;36mFunction: cmd.run\x1b[0;0m\n    \x1b[0;36m    Name: find . -name "/var/www/html/xxx/.cvsignore" -exec rm {} \\; > /dev/null 2>/dev/null\x1b[0;0m\n    \x1b[0;36m  Result: True\x1b[0;0m\n    \x1b[0;36m Comment: Command "find . -name "/var/www/html/xxx/.cvsignore" -exec rm {} \\; > /dev/null 2>/dev/null" run\x1b[0;0m\n    \x1b[0;36m Started: 09:40:22.850576\x1b[0;0m\n    \x1b[0;36mDuration: 20.146 ms\x1b[0;0m\n\x1b[0;36m     Changes:   \n              \x1b[0;36m----------\x1b[0;0m\n              \x1b[0;36mpid\x1b[0;0m:\n                  \x1b[0;1;33m18237\x1b[0;0m\n              \x1b[0;36mretcode\x1b[0;0m:\n                  \x1b[0;1;33m0\x1b[0;0m\n              \x1b[0;36mstderr\x1b[0;0m:\n              \x1b[0;36mstdout\x1b[0;0m:\x1b[0;0m\n\x1b[0;36m----------\x1b[0;0m\n    \x1b[0;36m      ID: change permission -> xxx\x1b[0;0m\n    \x1b[0;36mFunction: cmd.run\x1b[0;0m\n    \x1b[0;36m    Name: find . -name "/var/www/html/xxx/.#*" -exec rm {} \\; > /dev/null 2>/dev/null\x1b[0;0m\n    \x1b[0;36m  Result: True\x1b[0;0m\n    \x1b[0;36m Comment: Command "find . -name "/var/www/html/xxx/.#*" -exec rm {} \\; > /dev/null 2>/dev/null" run\x1b[0;0m\n    \x1b[0;36m Started: 09:40:22.871089\x1b[0;0m\n    \x1b[0;36mDuration: 16.728 ms\x1b[0;0m\n\x1b[0;36m     Changes:   \n              \x1b[0;36m----------\x1b[0;0m\n              \x1b[0;36mpid\x1b[0;0m:\n                  \x1b[0;1;33m18239\x1b[0;0m\n              \x1b[0;36mretcode\x1b[0;0m:\n                  \x1b[0;1;33m0\x1b[0;0m\n              \x1b[0;36mstderr\x1b[0;0m:\n              \x1b[0;36mstdout\x1b[0;0m:\x1b[0;0m\n\x1b[0;36m----------\x1b[0;0m\n    \x1b[0;36m      ID: change permission -> xxx\x1b[0;0m\n    \x1b[0;36mFunction: cmd.run\x1b[0;0m\n    \x1b[0;36m    Name: find . -name "/var/www/html/xxx/*.tpl.php" -exec rm {} \\; > /dev/null 2>/dev/null\x1b[0;0m\n    \x1b[0;36m  Result: True\x1b[0;0m\n    \x1b[0;36m Comment: Command "find . -name "/var/www/html/xxx/*.tpl.php" -exec rm {} \\; > /dev/null 2>/dev/null" run\x1b[0;0m\n    \x1b[0;36m Started: 09:40:22.888185\x1b[0;0m\n    \x1b[0;36mDuration: 16.258 ms\x1b[0;0m\n\x1b[0;36m     Changes:   \n              \x1b[0;36m----------\x1b[0;0m\n              \x1b[0;36mpid\x1b[0;0m:\n                  \x1b[0;1;33m18241\x1b[0;0m\n              \x1b[0;36mretcode\x1b[0;0m:\n                  \x1b[0;1;33m0\x1b[0;0m\n              \x1b[0;36mstderr\x1b[0;0m:\n              \x1b[0;36mstdout\x1b[0;0m:\x1b[0;0m\n\x1b[0;36m----------\x1b[0;0m\n    \x1b[0;36m      ID: add grains - on\x1b[0;0m\n    \x1b[0;36mFunction: grains.present\x1b[0;0m\n    \x1b[0;36m    Name: date_install_xxx\x1b[0;0m\n    \x1b[0;36m  Result: True\x1b[0;0m\n    \x1b[0;36m Comment: Set grain date_install_xxx to Tue Apr 27 07:29:34 UTC 2021\x1b[0;0m\n    \x1b[0;36m Started: 09:40:22.905714\x1b[0;0m\n    \x1b[0;36mDuration: 7.574 ms\x1b[0;0m\n\x1b[0;36m     Changes:   \n              \x1b[0;36m----------\x1b[0;0m\n              \x1b[0;36mdate_install_xxx\x1b[0;0m:\n                  \x1b[0;32mTue Apr 27 07:29:34 UTC 2021\x1b[0;0m\x1b[0;0m\n\x1b[0;36m\nSummary for ATOM236.xxx.com\n--------------\x1b[0;0m\n\x1b[0;32mSucceeded: 203\x1b[0;0m (\x1b[0;32mchanged=170\x1b[0;0m)\n\x1b[0;36mFailed:      0\x1b[0;0m\n\x1b[0;36m--------------\nTotal states run:     203\x1b[0;0m\n\x1b[0;36mTotal run time:   644.110 s\x1b[0;0m'

Somebody know how to format this well, like usual ?

Thanks in advance :)

1

There are 1 best solutions below

1
On

You can add --out= flag to the end of your command and use this list https://docs.saltproject.io/en/latest/ref/output/all/index.html to see what sort out output you would like

Something like

salt '*' foo.bar --out=pprint

Should be fine.