コード例 #1
0
ファイル: cluster.py プロジェクト: sundeer/rancher-cluster
def add_host(ctx, env='Default', instance_type=None):
    '''Add Rancher host to cluster'''
    current_servers = terraform.count_resource(ctx, 'server')
    if current_servers == 0:
        print('')
        print('No Rancher server found. Server must')
        print('be created prior to adding hosts')
        return 1

    current_hosts = terraform.count_resource(ctx, 'host')
    hosts = current_hosts + 1

    url, image = rancher.get_agent_registration_data(ctx, env)
    if url is None:
        print('')
        print('No such environment: {0}'.format(env))
        return 1

    # target only this host (host count starts with 0)
    target = 'aws_instance.host[{0}]'.format(hosts - 1)

    terraform.apply(
        ctx,
        hosts=hosts,
        instance_type=instance_type,
        agent_registration_url=url,
        rancher_agent_image=image,
        env=env,
        target=target
    )
コード例 #2
0
ファイル: cluster.py プロジェクト: sundeer/rancher-cluster
def add_host(ctx, env='Default', instance_type=None):
    '''Add Rancher host to cluster'''
    current_servers = terraform.count_resource(ctx, 'server')
    if current_servers == 0:
        print('')
        print('No Rancher server found. Server must')
        print('be created prior to adding hosts')
        return 1

    current_hosts = terraform.count_resource(ctx, 'host')
    hosts = current_hosts + 1

    url, image = rancher.get_agent_registration_data(ctx, env)
    if url is None:
        print('')
        print('No such environment: {0}'.format(env))
        return 1

    # target only this host (host count starts with 0)
    target = 'aws_instance.host[{0}]'.format(hosts - 1)

    terraform.apply(ctx,
                    hosts=hosts,
                    instance_type=instance_type,
                    agent_registration_url=url,
                    rancher_agent_image=image,
                    env=env,
                    target=target)
コード例 #3
0
ファイル: cluster.py プロジェクト: sundeer/rancher-cluster
def add_servers(ctx, number, instance_type=None):
    '''Add Rancher servers to cluster'''
    current_servers = terraform.count_resource(ctx, 'server')
    servers_to_add = int(number)
    servers = current_servers + servers_to_add
    terraform.apply(ctx, servers=servers, instance_type=instance_type)

    session = rancher.create_rancher_http_session(ctx)
    rancher.wait_for_server(ctx, session)
コード例 #4
0
ファイル: cluster.py プロジェクト: sundeer/rancher-cluster
def add_servers(ctx, number, instance_type=None):
    '''Add Rancher servers to cluster'''
    current_servers = terraform.count_resource(ctx, 'server')
    servers_to_add = int(number)
    servers = current_servers + servers_to_add
    terraform.apply(ctx, servers=servers, instance_type=instance_type)

    session = rancher.create_rancher_http_session(ctx)
    rancher.wait_for_server(ctx, session)
コード例 #5
0
ファイル: cluster.py プロジェクト: sundeer/rancher-cluster
def create_infra(ctx):
    '''Creates only the infrastructure, no serves/hosts will be created'''
    terraform.apply(ctx)
コード例 #6
0
ファイル: cluster.py プロジェクト: sundeer/rancher-cluster
def create_infra(ctx):
    '''Creates only the infrastructure, no serves/hosts will be created'''
    terraform.apply(ctx)