def create_server_rackspace(connection,<EOL>distribution,<EOL>disk_name,<EOL>disk_size,<EOL>ami,<EOL>region,<EOL>key_pair,<EOL>instance_type,<EOL>instance_name,<EOL>tags={},<EOL>security_groups=None):
log_yellow("<STR_LIT>")<EOL>flavor = connection.flavors.find(name=instance_type)<EOL>image = connection.images.find(name=ami)<EOL>server = connection.servers.create(name=instance_name,<EOL>flavor=flavor.id,<EOL>image=image.id,<EOL>region=region,<EOL>availability_zone=region,<EOL>key_name=key_pair)<EOL>while server.status == '<STR_LIT>':<EOL><INDENT>log_yellow("<STR_LIT>")<EOL>sleep(<NUM_LIT:5>)<EOL>server = connection.servers.get(server.id)<EOL><DEDENT>if server.status != '<STR_LIT>':<EOL><INDENT>log_red("<STR_LIT>")<EOL>exit(<NUM_LIT:1>)<EOL><DEDENT>ip_address = server.accessIPv4<EOL>if ip_address is None:<EOL><INDENT>log_red('<STR_LIT>')<EOL>exit(<NUM_LIT:1>)<EOL><DEDENT>wait_for_ssh(ip_address)<EOL>log_green('<STR_LIT>'.format(ip_address))<EOL>return server<EOL>
Creates Rackspace Instance and saves it state in a local json file