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 setup_minion(fab_master, master, upgrade=0): """Bootstraps and sets up a minion. Requires the ip address of the master. Options: fab_master: The method for this machine (running fabric) to connect to the master. This can be specified as "-H <IPADDRESS>" or fabric task name master: The address for the minion to connect to the master. upgrade: Set to 'yes' to upgrade all the minion's packages before installing salt-minion """ name = hostname() local('fab {0} create_minion_key:{1}'.format(fab_master, repr(name))) lowlevel.bootstrap(upgrade) lowlevel.minion(master, name, env.salt_roles) if env.salt_bleeding: lowlevel.convert_to_bleeding() time.sleep(1) service('salt-minion', 'start')