Tech insights and news. Best served hot.



Ansible Cloud Module and Libcloud Integration

Back in November 2016 we introduced our API, which allows you to manage your cloud servers automatically – directly from within your own application or deployment setup. With Ansible and Libcloud this just got even more comfortable: These two important open-source projects now support our API natively.

Ansible Cloud Module

Ansible is a platform for the orchestration and configuration management of applications, servers (especially Unix/Linux) and entire server farms. In addition to numerous other modules, Ansible allows you to interact with different cloud providers with its Cloud Modules – starting with version 2.3.0 it supports managing your servers at as well.

Creating a new server is like a walk in the park:

   - name: Start server
       name: my-shiny-cloudscale-server
       flavor: flex-4
       image: debian-8
       ssh_keys: ssh-rsa XXXXXXXXXX...XXXX

Apache Libcloud

Apache Libcloud is a Python library which abstracts the APIs of different IaaS providers. Libcloud enables you to access the resources of various cloud providers via a uniform Python syntax. Starting with version 1.5.0 Libcloud also includes a driver for the API to manage servers on our infrastructure directly from your source code.

Using Python and Libcloud you can create new servers with just a few lines of code:

   from libcloud.compute.types import Provider
   from libcloud.compute.providers import get_driver

   cls = get_driver('cloudscale')
   driver = cls(key='XXXXX')

   name = 'my-shiny-cloudscale-server'
   size = [ s for s in driver.list_sizes() if == 'flex-4' ][0]
   image = [ i for i in driver.list_images() if == 'debian-8' ][0]
   ssh_keys = [ open('').read().strip() ]

   node = driver.create_node(name=name,

Two tools, different areas of application

Ansible and its so-called playbooks are used to define and execute a sequence of tasks for system management. Therefore, Ansible has cleary defined areas of application: orchestration of IT processes, deployment of applications, or configuration management.

With Ansible and the Cloud Module it is possible to automate the whole process of setting up and operating highly available web services at – from creating virtual servers and deploying applications up to non-disruptive maintenance during operating system or application updates.

In contrast, Libcloud is a Python library. With Python as a universal programming language a wide range of applications can be implemented. So, Libcloud comes in handy whenever Python code is used to access cloud services. All of the included cloud providers are supported automatically without the developer having to write code for their specific integration.

Therefore, Libcloud is suitable wherever you use Python already – e.g. when directly integrated into your (web) application for more scalability, or in order to extend existing deployment and monitoring tools.

What the future holds

We are constantly working on new features for our cloud infrastructure and our API. In order to integrate these into Libcloud and Ansible, we are working with the respective open-source communities. For example, an integration into Ansible is planned for the recently introduced "Floating IP" feature.


A common advantage of cloud servers is that they can be deployed with just a few clicks. You can go one step further now: automate your server deployment with Ansible or Libcloud – no need to click at all.

Server setup made easy!
Your team


PS: We believe that an integration of the API into Terraform would be valuable as well. What's your take on this?

More news. Further insights.

Try it yourself and launch a Swiss Linux server today!