salt states trends jq yq
# install:
# wget https://gist.githubusercontent.com/epcim/e488af8be69b616eab3088a14a937e14/raw/salt-trends.sh -O salt-trends.sh; chmod +x *.sh
# salt state execution results: (use with/without test=true, -b2, etc..)
# apt install -y jq colordiff
salt \* state.apply ${1} --out=json --static test=true queue=true -b{BATCH_SIZE:-15} |\
jq -r 'to_entries | map({ key:.key, value: { total: [.value[]]|length ,
succeed: [.value[]|select(.result == true)]|length,
failed: [.value[]|select(.result == false)]|length,
changes: [select(.value[].changes|length > 0)]|length }}) | from_entries ' |\
tee trend_$(date "+%Y-%m-%d-%s")_${1}.json
ls trend*.json| sort |tail -n2 |xargs -n2 diff -y | colordiff