ip = lA.pub_ip(iid)
    acount = acount + 1

if osval == "Centos6":
    remoteuser = '******'
else:
    remoteuser = ''.join([i for i in osval if not i.isdigit()]).lower()

if os.path.exists(os.path.realpath(os.path.expanduser(keyloc))):
    print "waiting until contactable, ctrl-C to quit"
    try:
        remote = lD.remoteHost(remoteuser, ip, keyloc)
        lD.wait_until_up(remote, 20)
        if "Tags" in security_config:
            resources = lA.find_all_child_resources(iid)
            lA.tag_resources(resources, security_config["Tags"])
        remote.register()
        remote = lD.remote_cp_authkeys(remote, 'root')
        lD.rename_remote_host(remote, machinename, 'kave.io')
        lD.confallssh(remote)
        if osval.startswith("Centos"):
            remote.run("yum clean all")
        remote.describe()
    except KeyboardInterrupt:
        pass
else:
    print "Warning: not contactable since keyfile supplied does not exist locally,",
    print "also means I could not rename the host", keyloc

print "OK, iid " + iid + " now lives at IP " + ip
Example #2
0
remote.run("mkdir -p /etc/kave/")
remote.run(
    "/bin/echo http://repos:[email protected]/ >> /etc/kave/mirror"
)
lD.add_as_host(edit_remote=remote,
               add_remote=remote,
               dest_internal_ip=lA.priv_ip(iid))
lD.configure_keyless(remote,
                     remote,
                     dest_internal_ip=lA.priv_ip(iid),
                     preservehostname=True)
# This is not needed for Centos7
tos = remote.detect_linux_version()
lD.disable_security(remote)

lD.confallssh(remote, restart=False)
lD.confremotessh(remote, restart=False)
lD.confsshpermissions(remote)
vols = []
vols.append(
    lA.add_new_ebs_vol(iid, {
        "Mount": "/opt",
        "Size": 10,
        "Attach": "/dev/sdb"
    }, keyloc))
vols.append(
    lA.add_new_ebs_vol(iid, {
        "Mount": "/var/log",
        "Size": 2,
        "Attach": "/dev/sdc"
    }, keyloc))
    lD.mysleep(1)
    ip = lA.pub_ip(iid)
    acount = acount + 1

remoteuser = lA.default_usernamedict[osval]

if os.path.exists(os.path.realpath(os.path.expanduser(keyloc))):
    print "waiting until contactable, ctrl-C to quit"
    try:
        remote = lD.remoteHost(remoteuser, ip, keyloc)
        lD.wait_until_up(remote, 20)
        if "Tags" in security_config:
            resources = lA.find_all_child_resources(iid)
            lA.tag_resources(resources, security_config["Tags"])
        remote.register()
        remote = lD.remote_cp_authkeys(remote, 'root')
        lD.rename_remote_host(remote, machinename, 'kave.io')
        lD.confallssh(remote, restart=False)
        lD.confsshpermissions(remote)
        if osval.startswith("Centos"):
            remote.run("yum clean all")
        remote.describe()
        lD.disable_security(remote, firewall=False, permanent=False)
    except KeyboardInterrupt:
        pass
else:
    print "Warning: not contactable since keyfile supplied does not exist locally,",
    print "also means I could not rename the host", keyloc

print "OK, iid " + iid + " now lives at IP " + ip
Example #4
0
        instance_to_remote[iid] = remote

allremotes = [
    "ssh:root@" + remote.host for remote in instance_to_remote.values()
]
allremotes = lD.multiremotes(list_of_hosts=allremotes,
                             access_key=amazon_keyfile)
print "test local PDSH, install pdcp"
print allremotes.run("echo yes")
allremotes.run("yum clean all")
lD.install_pdsh(allremotes)

print "===================================="
print "configure SSH on all machines"
print "===================================="
lD.confallssh(allremotes, restart=False)
lD.confsshpermissions(allremotes)

print "===================================="
print "name the instances"
print "===================================="
sys.stdout.flush()
instance_to_name = {}

for instancegroup in cluster_config["InstanceGroups"]:
    count = instancegroup["Count"]
    autoname = True
    if count < 0:
        autoname = False
    if not autoname:
        instance_to_name[instancegroups[instancegroup["Name"]]
Example #5
0
            resources = lA.find_all_child_resources(iid)
            lA.tag_resources(resources, security_config["Tags"])
        remote.register()
        instance_to_remote[iid] = remote

allremotes = ["ssh:root@" + remote.host for remote in instance_to_remote.values()]
allremotes = lD.multiremotes(list_of_hosts=allremotes, access_key=amazon_keyfile)
print "test local PDSH, install pdcp"
print allremotes.run("echo yes")
allremotes.run("yum clean all")
lD.install_pdsh(allremotes)

print "===================================="
print "configure SSH on all machines"
print "===================================="
lD.confallssh(allremotes, restart=False)
lD.confsshpermissions(allremotes)

print "===================================="
print "name the instances"
print "===================================="
sys.stdout.flush()
instance_to_name = {}

for instancegroup in cluster_config["InstanceGroups"]:
    count = instancegroup["Count"]
    autoname = True
    if count < 0:
        autoname = False
    if not autoname:
        instance_to_name[instancegroups[instancegroup["Name"]][0]] = instancegroup["Name"].lower()
Example #6
0
        if "Tags" in security_config:
            resources = lA.find_all_child_resources(iid)
            lA.tag_resources(resources, security_config["Tags"])
        remote.register()
        instance_to_remote[iid] = remote

allremotes = ["ssh:root@" + remote.host for remote in instance_to_remote.values()]
allremotes = lD.multiremotes(list_of_hosts=allremotes, access_key=amazon_keyfile)
print "test PDSH"
print allremotes.run("echo yes")
allremotes.run("yum clean all")

print "===================================="
print "configure SSH on all machines"
print "===================================="
lD.confallssh(allremotes)

print "===================================="
print "name the instances"
print "===================================="
sys.stdout.flush()
instance_to_name = {}

for instancegroup in cluster_config["InstanceGroups"]:
    count = instancegroup["Count"]
    autoname = True
    if count < 0:
        autoname = False
    if not autoname:
        instance_to_name[instancegroups[instancegroup["Name"]][0]] = instancegroup["Name"]
        lA.name_resource(instancegroups[instancegroup["Name"]][0], cluster_name + '-' + instancegroup["Name"])