]> git.friedersdorff.com Git - max/saltfiles.git/blobdiff - bootstrap.sh
Implement bash state in saltstack
[max/saltfiles.git] / bootstrap.sh
diff --git a/bootstrap.sh b/bootstrap.sh
new file mode 100644 (file)
index 0000000..9cad37c
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+SALT_CMD="salt-call"
+
+install_salt() {
+       booststrap=${mktemp}
+       curl -L https://bootstrap.saltstack.com -o "${bootstrap}"
+       sudo sh "${bootstrap}" -P
+}
+
+if ! which $SALT_CMD; then
+       install_salt
+fi
+
+if [[ ! $1 ]]; then
+       sudo $SALT_CMD \
+               --local \
+               --config=./ \
+               --state_verbose=True \
+               --state-output=mixed \
+               --log-level=quiet \
+               --retcode-passthrough state.highstate
+else
+       sudo $SALT_CMD \
+               --local \
+               --config=./ \
+               --state_verbose=True \
+               --state-output=mixed \
+               --log-level=quiet \
+               --retcode-passthrough state.sls $1
+fi