Exemple #1
0
def provision_machine(manifest='crunch_01.pp'):
    # Retrieve EC2 tags for this machine, and see if there is a manifest tag
    # among them. If yes, that one has priority over what gets specified as
    # a parameter to this function.
    tags = get_tags_for_machine(env.host_string)
    if 'manifest' in tags:
        manifest = tags['manifest']

    # Run the actual manifest for provisioning this node from the repo
    run("sudo puppet apply /home/ami/AmI-Platform/provisioning/nodes/%s" % manifest)
Exemple #2
0
def generate_services_file():
    """ Given a crunch node, generate a settings_local.py file which
    contains the list of services that should run on this machine. """

    tags = get_tags_for_machine(env.host_string)
    if not 'modules' in tags:
        print("No modules are specified as EC2 tags for hostname %s" %
              env.host_string)
        return

    modules = tags['modules'].split(',')
    file_path = ('/home/ami/AmI-Platform/services.%s.txt' %
                 str(run('hostname -s')))
    run('echo "" > %s' % file_path)
    for module in modules:
        run('echo "%s" >> %s' % (module, file_path))