Created
November 12, 2018 17:02
-
-
Save ThinGuy/4657cc1c691cfec043f1a08df21e4f09 to your computer and use it in GitHub Desktop.
Run commands in parallel on deployed machines
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
# Run dist-upgrade all deployed machines running ubuntu | |
(maas admin machines read|jq -r '.[]|select((.status==6) and .osystem=="ubuntu").hostname')|\ | |
xargs -n1 -P0 bash -c 'ssh $0 "sudo 2>/dev/null bash -c '"'"'apt update;apt dist-upgrade -y;apt autoremove -y'"'"'"' | |
# Run dist-upgrade all deployed machines running ubuntu with a certain tag | |
# To see list of tags, run: maas admin tags read|jq -r '.[].name' | |
(maas admin tag machines ${TAG}|jq -r '.[]|select((.status==6) and .osystem=="ubuntu").hostname')|\ | |
xargs -n1 -P0 bash -c 'ssh $0 "sudo 2>/dev/null bash -c '"'"'apt update;apt dist-upgrade -y;apt autoremove -y'"'"'"' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment