Created
February 11, 2015 01:39
-
-
Save keeth/fee091964e6fb1db22a1 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
from fabric.api import * | |
import time | |
def bootstrap_salt_master(): | |
sudo('add-apt-repository ppa:saltstack/salt -y') | |
sudo('apt-get update -y') | |
sudo('apt-get install salt-minion -y') | |
sudo('apt-get install salt-master -y') | |
sudo('apt-get upgrade -y') | |
ssh_files = [ | |
'/root/.ssh/id_rsa_cms.private', | |
'/root/.ssh/id_rsa_salt.private', | |
'/root/.ssh/id_rsa_secrets.private', | |
'/root/.ssh/config', | |
] | |
for file in ssh_files: | |
put(file, file, use_sudo=True) | |
sudo("chmod 400 %s" % file) | |
sudo("chown root %s" % file) | |
etc_files = [ | |
'/etc/salt/master.d/_defaults.conf', | |
'/etc/salt/minion.d/_defaults.conf', | |
] | |
for file in etc_files: | |
put(file, file, use_sudo=True) | |
sudo("chmod 644 %s" % file) | |
sudo("chown root %s" % file) | |
sudo('service salt-master restart') | |
time.sleep(5) | |
sudo('service salt-minion restart') | |
time.sleep(5) | |
sudo('salt-key -A -y') | |
sudo('salt-run fileserver.update') | |
sudo('salt-call saltutil.refresh_pillar') | |
sudo('salt-call state.highstate') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment