Deploy Cloudstack Management Server Using Ansible – Part I (MariaDB)

Introduction

Hello, In this guide we’ll look at how to deploy cloudstack management server using ansible.

Before we go further, its good to have a brief introduction of Ansible.

About Ansible

Ansible is an IT configuration management and provisioning tool that enables System administrators to deploy and manage infrastructure as code.

Ansible is easy to setup. Its is agentless i.e no need to install an agent on the target host inorder to manage it. Ansible uses ssh to connect to the target hosts.

It can also do IT orchestration, where you have to run tasks in sequence and create a chain of events which must happen on several different servers or devices.

Some of the benefits of Ansible are:

  1. Ansible configuration is human readable and easy to understand.
  2. Code by convention: Structure of the code follows a convetion
  3. To access a target host, you do not need an agent. Access is provided via ssh
  4. A great, dedicated and growing community
  5. A host inventory handles and defines the infrastructure

Ansible is available for free and runs on Linux, Mac or BSD. Aside from the free offering, Ansible also has an enterprise product called Ansible Tower.

Ansible works by concept of Playbooks, Roles, tasks and inventories. These are the main components of an ansible playbook.  Visit https://www.ansible.com/ for more details on how ansible works.

 

Installing Ansible

To use ansible, it must be installed on a local machine that you will use to administer remote hosts. In our case, our local machine will be a centos 7 vm.

Run the following command to install ansible

We don’t need any further configuration. We are good to get started.

Lets get started with Cloudstack.

 

Prepare the directory structure for our ansible Roles. We’ll have s Roles in this article. i.e

  1. Common
  2. Mariadb
  3. Management Server
  4. KVM Host
  5. NFS Server

Create the required directory tree as below. Our main directory will be called cloudstack.

cd to cloudstack directory.

Create the directories for the different roles as below

Create the main.yml files under each directory in the different roles as below

Run tree to confirm the layout

We are now ready to begin adding our code

Create and Update Inventory File

create inventory file and open it

Update the inventory file as below and change where applicable

Common Role

The common role will contain task that will be applied to all the hosts. These are tasks such as Updating packages, installing common packages e.t.c

Let’s switch to tasks directory under the common role

Open the main.yml file and add the following code

The above code will update yum packages, install specified packages and set selinux to permissive on all the hosts.

That’s enough for the common role.

After Preparing all the nodes, we can now setup MariaDB

MariaDB Role

Switch to MariaDB default directory. Here we’ll set up our default values that will be used in this role. this will include values such as MySQL usernames, passwords, IP addresses e.t.c

Open the main.yml file and add the following content

Switch to MariaDB task directory

Add the following code to the main.yml file

Switch to MariaDB handlers directory and update the main.yml file as below

Next we’ll look at Deploying the Cloudstack Management Server.

Series NavigationDeploy Cloudstack Management Server Using Ansible – Part II (Management Server) >>
The following two tabs change content below.

harun

Harun is a System Administrator with proficient knowledge in cloud technologies such as KVM, Cloudstack, Citrix Xen Server, Openstack and VMware Vsphere Suite, Ceph, NFS, ISCSI

Latest posts by harun (see all)

Leave a Reply

Your email address will not be published. Required fields are marked *