Created
August 18, 2017 19:17
-
-
Save brianthelion/a90d486adc50517f341228d8a2069e91 to your computer and use it in GitHub Desktop.
Salt cluster bootstrapping recipe
This file contains 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
CONFIG_DIR=$(mktemp -d) | |
FILE_ROOT=$(mktemp -d) | |
ROOT_DIR=$(mktemp -d) | |
cat <<EOF > $CONFIG_DIR/master | |
root_dir: $ROOT_DIR | |
file_roots: | |
base: | |
- $FILE_ROOT | |
EOF | |
cat <<EOF > $CONFIG_DIR/cloud | |
default_include: | |
deploy_scripts_search_path: $CONFIG_DIR | |
EOF | |
wget -O - https://bootstrap.saltstack.com > $CONFIG_DIR/bootstrap.sh | |
cat <<EOF > $CONFIG_DIR/cloud.providers | |
my-aws-default: | |
id: $AWS_CRED_ID | |
key: $AWS_CRED_VALUE | |
keyname: $AWS_SSH_KEY_NAME | |
securitygroup: ssh-only | |
private_key: $LOCAL_SSH_KEY_PATH | |
driver: ec2 | |
EOF | |
cat <<EOF > $CONFIG_DIR/cloud.profiles | |
minion: | |
provider: my-aws-default | |
size: t2.micro | |
image: ami-7b4d7900 | |
script: bootstrap | |
ssh_username: ubuntu | |
EOF | |
cat <<EOF > $FILE_ROOT/test.sls | |
{{ sls }}:test-minion: | |
salt.runner: | |
- name: cloud.profile | |
- prof: minion | |
- instances: | |
- test-minion | |
EOF | |
salt-run --log-level=all --config-dir=$CONFIG_DIR state.orchestrate test | |
rm -rf $CONFIG_DIR $FILE_ROOT $ROOT_DIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment