Ansible2018.05.16 10:00


It's rain in out of the office. My office building elevator is not working. I walked up the stairs to the 14th floor. It's so hot. How is your day?


In this blog, I would like to post about how to provision OpenStack Instance using Ansible. Before develop Ansible playbook, we need to prepare test environment like below.

  • Github repository : There are OpenStack provisioning Playbook.

  • Ansible Tower : It will makes Job Template using playbook of Github repository and It will plays.

  • OpenStack Director : I will install Shade OpenStack module for Ansible

  • OpenStack Controller Node : The Ansible playbook will call OpenStack API of this node.

  • OpenStack Compute Node : It will create OpenStack Instance in this node.

This Job flow is like below. If your test environment preparing is done, you need to develop playbook and upload it to the your github repository first. And then,  you need to configure github repository information and OpenStack director credential. And you make Job Template for provisioning OpenStack instance using your github playbook.

To develop ansible playbook, we need to design provisioning task process.

Before OpenStack instance create, OpenStack needs OS image, network, keypiar, flavor and security group. We can express these process like below.

Above each task process can make role process.


When upload OS image to glance, we need to download OS image first. And then downloaded image can upload to glance.


Openstack needs to create Public network and Tenant network for providing network ip to instance.

If you use Tenant network, you need to create Router for connecting each public and tenant network. 


Keypair needs when we connect Instance more safely. First, it generate ssh key and register public key file.

OSP-Security Group

Security Group is firewall for instances. If your instance is for web service, you would create "web security group" and add http service port to the created web security group.


Flavor is spec of instance like cpu, memory and hard disk.

Create Instance

After it makes all resources without instances, you can create instance. If creating instance is done, floating ip add to created instance. And you would wait for being available instance status.

Playbook Architecture

Right now, it's time to develop ansible playbook. You would make git directory for developing playbook like below.

When we develop playbook, we need sample playbook code. Below code is example codes for provisiong instance.

# Create a new instance with 4G of RAM on a 75G Ubuntu Trusty volume
- name: launch a compute instance
  hosts: localhost
    - name: launch an instance
        name: vm1
        state: present
        cloud: mordred
        region_name: ams01
        image: Ubuntu Server 14.04
        flavor_ram: 4096
        boot_from_volume: True
        volume_size: 75

Following urls are included example codes that you need for developing playbook. You can develop playbook as refer below url.

Actually this blog's contents is part of my ansible training lesson in China. After came back to Korea, I wanted to summarize about my training. Finally I am so happy cause I summarize this.

'Ansible' 카테고리의 다른 글

My First Ansible Presentation Story  (1) 2018.07.05
AWS EC2 with Ansible Episode  (0) 2018.06.01
OpenStack Instance auto provisioning with Ansible  (0) 2018.05.16
My First Ansible Project Episode II  (0) 2018.05.08
My First Ansible Project Episode I  (0) 2018.05.04
Posted by 나리 짱!!! naleejang