Example #1
0
def _add_saltcloud_conf(manifest, cloud):
    saltcloud_conf = yaml.load(
        filesystem.read_file('cloudseed/current/salt/cloud'))

    if not saltcloud_conf:
        saltcloud_conf = {}

    ssh_interface = cloud.opts.get('ssh_interface', 'private_ips')

    interface_ips = {
        'public_ips': cloud.opts['cloudseed'].get('ip_address', None),
        'private_ips': cloud.opts['cloudseed'].get('private_ip_address', None)
    }

    target_ip = interface_ips.get(ssh_interface, None)

    if not target_ip:
        # TODO Better, more informative error please.
        raise RuntimeError


    saltcloud_conf['minion'] = {
    'master': target_ip}

    saltcloud_obj = writers.write_stringio(
        yaml.safe_dump(saltcloud_conf, default_flow_style=False))

    manifest.add(saltcloud_obj, '/etc/salt/cloud')
Example #2
0
def sync_full_manifest(manifest):
    cloud = cloudseed.cloud.Cloud(__opts__)
    vm_ = cloud.vm_profile('master')

    keyname = '%s-%s' % (env.location_name(), env.env_name())

    filename = os.path.join(
        env.current_env_path(),
        'salt',
        '%s.pem' % keyname)

    manifest.add(filename, '/etc/salt/cloud.pem')

    # changing the path to the private_key file to work on
    # the bootstrapped master
    providers = filesystem.read_file(__opts__['providers_config'])

    providers_data = yaml.load(providers)
    alias, driver = vm_['provider'].split(':')
    master_provider = providers_data[alias]

    master_provider['private_key'] = '/etc/salt/cloud.pem'
    cloud_providers = yaml.safe_dump(providers_data, default_flow_style=False)

    manifest.remove('cloudseed/current/salt/cloud.providers')

    manifest.add(
        writers.write_stringio(cloud_providers),
        '/etc/salt/cloud.providers')
Example #3
0
def _add_saltcloud_conf(manifest, cloud):
    saltcloud_conf = yaml.load(
        filesystem.read_file('cloudseed/current/salt/cloud'))

    if not saltcloud_conf:
        saltcloud_conf = {}

    ssh_interface = cloud.opts.get('ssh_interface', 'private_ips')

    interface_ips = {
        'public_ips': cloud.opts['cloudseed'].get('ip_address', None),
        'private_ips': cloud.opts['cloudseed'].get('private_ip_address', None)
    }

    target_ip = interface_ips.get(ssh_interface, None)

    if not target_ip:
        # TODO Better, more informative error please.
        raise RuntimeError

    saltcloud_conf['minion'] = {'master': target_ip}

    saltcloud_obj = writers.write_stringio(
        yaml.safe_dump(saltcloud_conf, default_flow_style=False))

    manifest.add(saltcloud_obj, '/etc/salt/cloud')
Example #4
0
def sync_full_manifest(manifest):
    cloud = cloudseed.cloud.Cloud(__opts__)
    vm_ = cloud.vm_profile('master')

    keyname = '%s-%s' % (env.location_name(), env.env_name())

    filename = os.path.join(env.current_env_path(), 'salt', '%s.pem' % keyname)

    manifest.add(filename, '/etc/salt/cloud.pem')

    # changing the path to the private_key file to work on
    # the bootstrapped master
    providers = filesystem.read_file(__opts__['providers_config'])

    providers_data = yaml.load(providers)
    alias, driver = vm_['provider'].split(':')
    master_provider = providers_data[alias]

    master_provider['private_key'] = '/etc/salt/cloud.pem'
    cloud_providers = yaml.safe_dump(providers_data, default_flow_style=False)

    manifest.remove('cloudseed/current/salt/cloud.providers')

    manifest.add(writers.write_stringio(cloud_providers),
                 '/etc/salt/cloud.providers')