sv_512 = [flavor for flavor in helper.act_loop(cs.flavors.list) if "512" in flavor.name][0] # queue a list of servers to build out queued_servers = [] data = {} for host in create_servers: data = { 'name': host, 'os_img_id': latest_cent_os_img.id, 'flavor_id': sv_512.id, 'files': None, 'completed': 'no' } queued_servers.append(data) # build out the servers in the queue finished_servers = helper.build_servers(queued_servers) nodes = [] print ' ' print '-------------' print 'YAY, TIME FOR THE BUILD REPORT..' print '-------------' for svr in finished_servers: print "ID:", svr['id'] print "Server:", svr['name'] print "Public IP:", svr['pub'] print "Private IP:", svr['priv'] print "Admin password:", svr['pass'] print '-------------'
with open ("/root/.ssh/authorized_keys", "r") as root_ssh_auth_keys: ssh_auth_file=root_ssh_auth_keys.read().replace('\n', '') files = {"/root/.ssh/authorized_keys": ssh_auth_file} create_servers = ['test123', 'test123-banana'] queued_servers = [] data = {} for host in create_servers: data = { 'name': host, 'os_img_id': 'c195ef3b-9195-4474-b6f7-16e5bd86acd0', 'flavor_id': '2', 'files': files, 'completed': 'no' } queued_servers.append(data) finished_servers = helper.build_servers(queued_servers) print ' ' print '-------------' print 'YAY, TIME FOR THE BUILD REPORT..' print '-------------' print ' ' for svr in finished_servers: print "ID:", svr['id'] print "Server:", svr['name'] print "Public IP:", svr['pub'] print "Private IP:", svr['priv'] print "Admin password:", svr['pass'] print '-------------'