Last active
December 12, 2015 01:29
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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