Last active
September 5, 2021 00:45
-
-
Save vitalvas/a31e3f9434a6a93862bc1f207c47f3b1 to your computer and use it in GitHub Desktop.
fetch all from salt-master
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| for env in $(salt-call cp.envs --out=json | jq '.local[]' | tr -d '"'); do | |
| mkdir -p salt/${env} | |
| for row in $(salt-call cp.list_master saltenv=${env} --out=json | jq '.local[]' | tr -d '"' | tr '/' ' ' | awk '{print $1}' | sort | uniq); do | |
| if [[ "${row}" =~ .sls$ ]]; then | |
| salt-call cp.get_file saltenv=${env} salt://${row} salt/${env} | |
| else | |
| salt-call cp.get_dir saltenv=${env} salt://${row} salt/${env} | |
| fi | |
| done | |
| done | |
| salt-call state.show_states --out=json > salt/state.json | |
| salt-call pillar.items --out=json > salt/pillar.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment