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)) vols.append( lA.add_new_ebs_vol(iid, { "Mount": "/home", "Size": 100, "Attach": "/dev/sdd" }, keyloc))
################################################## print "Renaming, configuring firewall and adding more disk space" lD.rename_remote_host(remote, username + "_dev_box", 'kave.io') 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)) vols.append(lA.add_new_ebs_vol(iid, {"Mount": "/home", "Size": 100, "Attach": "/dev/sdd"}, keyloc)) remote.describe() if "Tags" in security_config: lA.tag_resources(vols, security_config["Tags"]) print "OK, iid " + iid + " now lives at IP " + ip ################################################## # Installing vnc ################################################## # print "installing vnc and gnome desktop" # remote.run('yum -y install epel-release') # remote.run('yum clean all') # remote.run("yum -y install vim emacs wget curl zip unzip tar gzip rsync git")
remote.register() print "Renaming, configuring firewall and adding more disk space" lD.rename_remote_host(remote, "ambari", 'kave.io') remote.run("mkdir -p /etc/kave/") remote.run("/bin/echo http://repos:[email protected]/ >> /etc/kave/mirror") remote.run('yum install curl nss -y; yum update curl nss -y --enablerepo="updates"') 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) # nope! Don't want 443 as ssh by default any longer! # lD.confremotessh(remote) # This is not needed for Centos7 lD.disable_security(remote) lD.confallssh(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)) vols.append(lA.add_new_ebs_vol(iid, {"Mount": "/usr/hdp", "Size": 4, "Attach": "/dev/sdd"}, keyloc)) tos = remote.detect_linux_version() if tos in ["Centos7"]: vols.append(lA.add_new_ebs_vol( iid, {"Mount": "/var/lib/ambari-agent", "Size": 1, "Attach": "/dev/sde"}, keyloc)) vols.append(lA.add_new_ebs_vol( iid, {"Mount": "/var/lib/ambari-server", "Size": 2, "Attach": "/dev/sdf"}, keyloc)) remote.describe() if "Tags" in security_config: lA.tag_resources(vols, security_config["Tags"]) print "OK, iid " + iid + " now lives at IP " + ip ip = "" remote = ""
print __doc__ raise IOError("please specify keyfile or set AWSSECCONF environment variable!") security_config = os.path.expanduser(os.environ["AWSSECCONF"]) try: jsondat = open(security_config) security_config_json = json.loads(jsondat.read()) jsondat.close() ssh_keyfile = security_config_json["AccessKeys"]["SSH"]["KeyFile"] except KeyError: raise KeyError('Your security config file must contain ["AccessKeys"]["SSH"]["KeyFile"] ' + security_config) instancegroups = {} installfrom = os.path.realpath(os.path.dirname(__file__)) liblocation = os.path.realpath(installfrom + '/../lib') sys.path.append(liblocation) import kaveaws as lA import kavedeploy as lD lD.debug = verbose lD.strict_host_key_checking = strict lA.testaws() lA.lD.testproxy() print "Initial tests OK, now adding volume (may take considerable time depending on volume size)" volID = lA.add_new_ebs_vol(iid, mount_conf, ssh_keyfile) if "Tags" in security_config_json: lA.tag_resources([volID], security_config_json["Tags"])
security_config = os.path.expanduser(os.environ["AWSSECCONF"]) try: jsondat = open(security_config) security_config_json = json.loads(jsondat.read()) jsondat.close() ssh_keyfile = security_config_json["AccessKeys"]["SSH"]["KeyFile"] except KeyError: raise KeyError( 'Your security config file must contain ["AccessKeys"]["SSH"]["KeyFile"] ' + security_config) instancegroups = {} installfrom = os.path.realpath(os.path.dirname(__file__)) liblocation = os.path.realpath(installfrom + '/../lib') sys.path.append(liblocation) import kaveaws as lA import kavedeploy as lD lD.debug = verbose lD.strict_host_key_checking = strict lA.testaws() lA.lD.testproxy() print "Initial tests OK, now adding volume (may take considerable time depending on volume size)" vol_id = lA.add_new_ebs_vol(iid, mount_conf, ssh_keyfile) if "Tags" in security_config_json: lA.tag_resources([vol_id], security_config_json["Tags"])