How to launch a DreamCompute server with Ansible

Overview

Ansible is a configuration management tool with built in OpenStack support. Using Ansible, you can deploy and manage servers on DreamCompute. This tutorial explains how to install Ansible and use it to launch a server on DreamCompute.

Setup

This tutorial uses Ubuntu 16.04 (Xenial Xerus) as the host to run Ansible playbooks. First, install a few packages using the following command.

Now you have 'shade' installed and are ready to start writing Ansible playbooks.

What are Playbooks?

Playbooks are Ansible’s configuration, deployment, and orchestration language. At a basic level, playbooks can be used to manage configurations and deployments to remote machines. Playbooks are designed to be human-readable and are developed in a basic text language.

Writing a Ansible Playbook to launch a server

Create a file named launch-server.yaml and enter the following lines into it.

The following examples add on to the example before. You only need to update the code in green text each time.

Make sure to indent as described below. Incorrect spacing will cause the file to fail to run.

The first part of your playbook is a list of hosts that your playbook will run on. In this case there is one, localhost.

# hosts the playbook runs on
- hosts: localhost

Since 'shade' has been installed in the virtualenv, you must tell ansible to use this virtualenv. Move to the next line, indent 2 spaces, then add these lines.