Skip to content

Instantly share code, notes, and snippets.

@keeth
Created Feb 11, 2015
Embed
What would you like to do?
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