Created
September 26, 2017 19:51
-
-
Save jalberto/3c2dedd7537dd723584ffee5bf88c46c to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
# Install Azure File Storage in a docker swarm from master | |
DRV_VER="v0.5.1" | |
AZURE_ACCOUNT="myaccount" | |
AZURE_KEY="mykey" | |
install_driver () { | |
sudo apt-get install -q -y cifs-utils | |
wget -q https://github.com/Azure/azurefile-dockervolumedriver/releases/download/${DRV_VER}/azurefile-dockervolumedriver | |
sudo mv azurefile-dockervolumedriver /usr/bin/azurefile-dockervolumedriver | |
sudo chmod +x /usr/bin/azurefile-dockervolumedriver | |
} | |
install_config () { | |
# wget https://raw.githubusercontent.com/Azure/azurefile-dockervolumedriver/master/contrib/init/systemd/azurefile-dockervolumedriver.default | |
# sudo mv azurefile-dockervolumedriver.default /etc/default/azurefile-dockervolumedriver | |
sudo rm /etc/default/azurefile-dockervolumedriver | |
echo "AZURE_STORAGE_BASE=core.windows.net" | sudo tee --append /etc/default/azurefile-dockervolumedriver | |
echo "AZURE_STORAGE_ACCOUNT=${AZURE_ACCOUNT}" | sudo tee --append /etc/default/azurefile-dockervolumedriver | |
echo "AZURE_STORAGE_ACCOUNT_KEY=${AZURE_KEY}" | sudo tee --append /etc/default/azurefile-dockervolumedriver | |
} | |
install_service () { | |
wget -q https://raw.githubusercontent.com/Azure/azurefile-dockervolumedriver/master/contrib/init/systemd/azurefile-dockervolumedriver.service | |
sudo mkdir -p /etc/systemd/system | |
sudo mv azurefile-dockervolumedriver.service /etc/systemd/system/azurefile-dockervolumedriver.service | |
} | |
enable_service () { | |
sudo systemctl daemon-reload | |
sudo systemctl enable azurefile-dockervolumedriver | |
sudo systemctl start azurefile-dockervolumedriver | |
} | |
run () { | |
install_driver | |
install_config | |
install_service | |
enable_service | |
} | |
spread () { | |
docker node ls --format "{{.Hostname}}" | while read -r hostname ; do | |
echo "***************** Processing $hostname" | |
scp -o "StrictHostKeyChecking no" install-afs.sh $hostname:/tmp/ | |
ssh -o "StrictHostKeyChecking no" -n $hostname sudo sh /tmp/install-afs.sh run | |
echo "***************** Done $hostname" | |
done | |
} | |
$@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment