shade/doc/source/user/examples/create-server-dict.py
Doug Hellmann 20b2f1f0c0 reorganize docs using the new standard layout
Move the docs around a little to allow the new templated docs.o.o site
link to things like the user and install guides in the expected location.

Change-Id: I7f3b625c04aa6cd2a7ebe5f2ce4a398cf464b1cc
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-06-30 10:07:41 -04:00

23 lines
886 B
Python

import shade
# Initialize and turn on debug logging
shade.simple_logging(debug=True)
for cloud_name, region_name, image, flavor_id in [
('my-vexxhost', 'ca-ymq-1', 'Ubuntu 16.04.1 LTS [2017-03-03]',
'5cf64088-893b-46b5-9bb1-ee020277635d'),
('my-citycloud', 'Buf1', 'Ubuntu 16.04 Xenial Xerus',
'0dab10b5-42a2-438e-be7b-505741a7ffcc'),
('my-internap', 'ams01', 'Ubuntu 16.04 LTS (Xenial Xerus)',
'A1.4')]:
# Initialize cloud
cloud = shade.openstack_cloud(cloud=cloud_name, region_name=region_name)
# Boot a server, wait for it to boot, and then do whatever is needed
# to get a public ip for it.
server = cloud.create_server(
'my-server', image=image, flavor=dict(id=flavor_id),
wait=True, auto_ip=True)
# Delete it - this is a demo
cloud.delete_server(server, wait=True, delete_ips=True)