def setup_master(and_minion=1, upgrade=0): """Bootstraps and sets up a master. Sets up a minion pointing to itself unless otherwise said. Options: and_minion: Set to 'no' to not install salt-minion. upgrade: Set to 'yes' to upgrade all system packages before installing salt. """ lowlevel.bootstrap(upgrade) lowlevel.master() lowlevel.upload(sync=False) if boolean(and_minion): name = hostname() roles = ['salt-master'] + list(env.salt_roles) lowlevel.create_minion_key(name) lowlevel.minion(master='127.0.0.1', hostname=name, roles=roles) if env.salt_bleeding: lowlevel.convert_to_bleeding() time.sleep(1) if boolean(and_minion): service('salt-minion', 'start') service('salt-master', 'start')
def create_minion_key(hostname): "Creates a minion key from the master and downloads it" lowlevel.create_minion_key(hostname)