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.
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.
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.
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.
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.
- 오픈스택을 다루는 기술