Skip to content

Instantly share code, notes, and snippets.

@kacole2
Created January 9, 2016 18:48
Show Gist options
  • Save kacole2/cbed7d374de05ed625fa to your computer and use it in GitHub Desktop.
Save kacole2/cbed7d374de05ed625fa to your computer and use it in GitHub Desktop.
Install REX-Ray on Multiple Hosts Created With Docker Machine
#!/bin/bash
# Read more about REX-Ray storage persistance:
# https://github.com/emccode/rexray
# change the filter and grep to anything you want to search for.
# This example shows searching for the name of machines beginning with "dev"
# You can sort by driver or swarm instance, just change the awk column as well
ALLHOSTS=$(docker-machine ls --filter name=dev* | grep dev* | awk '{print $1}')
# This is the location of the REX-Ray Configuration file. ie, Your desktop
# Learn more about configuration files: http://rexray.readthedocs.org/en/latest/
REXCONFIG="/Users/kcoleman/Desktop/rexconfig.yml"
for host in $ALLHOSTS
do
echo "$host: Installing REX-Ray"
docker-machine ssh $host "curl -sSL https://dl.bintray.com/emccode/rexray/install | sh -"
echo "$host: Setting Permissions for REX-Ray Config File"
docker-machine ssh $host "sudo chmod 777 /etc/rexray"
echo "$host: SCPing REX-Ray Config File from $REXCONFIG"
docker-machine scp $REXCONFIG $host:/etc/rexray/config.yml
echo "$host: Starting REX-Ray Service"
docker-machine ssh $host "sudo rexray start"
done
@clintkitson
Copy link

Would probably be best to set permissions to 700 on that directory after transferring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment