Skip to content

Instantly share code, notes, and snippets.

@eschnou
Last active December 12, 2015 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eschnou/4691830 to your computer and use it in GitHub Desktop.
Save eschnou/4691830 to your computer and use it in GitHub Desktop.
Just imagine what becomes possible when any resources from your infrastructure can be observed and manipulated through software. A short preview of the new ComodIT Python API. Learn more at http://comodit.com.
from comodit_client.api import Client
# Connect to ComodIT
client = Client('https://my.comodit.com/api', 'demo', '******')
# Define a new host
env = client.get_organization('Demo').get_environment('Default')
host = env.hosts().create('my-new-host', '', 'Demo Platform', 'Demo Distribution')
# Deploy the host
host.provision()
host.wait_for_state('READY')
# Install the Wordpress application
host.install('Wordpress', {'wp_admin_password': '*******', 'wp_admin_email': 'nobody@example.com'})
host.wait_for_pending_changes()
# Update the blog title
host.get_application('Wordpress').settings().create('wp_blog_title','The Infrastructure 2.0 Blog')
# Retrieve instance's hostname
hostname = host.get_instance().get_property('publicDnsName')
print "Wordpress available at http://%s/" % hostname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment