Deploying Ceph using Ansible

In this book, we have discussed deploying Ceph in multiple ways, which includes using Ceph-deploy and the Virtual Storage Manager (VSM). Both of these methods require the manual installation and configuration of the Ceph cluster. However, there exist other tools and methods that can install and deploy Ceph for you in a highly automated fashion. With such tools, you no longer need to type boring commands to deploy Ceph; configuration management tools such as Ansible, Puppet, and Chef, among others, can install and configure the Ceph cluster as you like.

Getting ready

In this recipe, we will go through Ansible, which is a very simple IT automation and configuration management tool; for more information on Ansible, take a look at http://www.ansible.com/how-ansible-works. The Ceph ecosystem has a vibrant community around it that has developed ready-to-use Ansible modules for Ceph. We will be using these ceph-ansible modules (refer to https://github.com/ceph/ceph-ansible) to deploy the Ceph cluster using Ansible.

How to do it…

There are two ways you can deploy Ceph using the ceph-ansible modules:

  • Use the ceph-ansible module to first launch a few virtual machines using Vagrant and VirtualBox/VMware, and then install and configure Ceph using Ansible.
  • Use the ceph-ansible module to install and configure the Ceph cluster using the Ansible playbooks on bare metal machines.

In this recipe, we will be using the first method, that is, using the ceph-ansible module to launch the VirtualBox virtual machines, and Ansible to install and deploy the Ceph cluster.

Note

The ceph-ansible modules are community focused and mature enough for you to use to deploy Ceph in your production environment. I would like to appreciate the great work done by the ceph-ansible community in developing, improving, and maintaining the ceph-ansible modules.

  1. On your VirtualBox host machine, Git clone the latest ceph-ansible module:
    $ git clone https://github.com/ceph/ceph-ansible.git
    $ cd ceph-ansible
    
  2. ceph-ansible uses Vagrant. For this purpose, it comes with Vagrantfile, which tells Vagrant how to spin up VMs. This file requires some variables that are being defined by another file: vagrant_variables.yml. The ceph-ansible module comes with vagrant_variables.yml.sample, which can be used directly with minimal changes:
    $ cp vagrant_variables.yml.sample vagrant_variables.yml
    
  3. The default configuration for Vagrant is defined in vagrant_variables.yml, and it's good to go. If you like, you can tweak the configuration by editing this file. Since this is a test cluster, we will reduce the number of Ceph monitors from 3 to 1 by changing the mon_vms variable to 1.
  4. The ceph-ansible module forces Vagrant to use Ansible as its provisioner; for this purpose, copy the site.yml.sample file as site.yml in the same hierarchy:
    $ cp site.yml.sample site.yml
    
  5. Finally, we will execute vagrant up, which will launch 4 VMs (1 Ceph monitor and 3 Ceph OSDs), and after that, it will start installing and deploying Ceph using the configuration management tool, Ansible:
    $ vagrant up
    
  6. VM provisioning and Ceph deployment will take a few minutes; after completion, you should see something like this:
    How to do it…
  7. After successful completion, you will end up with a running Ceph cluster, installed and configured by Ansible. Log in to the mon0 node and check your cluster status:
    $ vagrant ssh mon0
    $ sudo ceph -s
    
    How to do it…

There's more…

This Vagrant setup can be destroyed using vagrant destroy -f and recreated anytime within a few minutes in an automated, smart fashion. You would have noticed how easy, quick, and seamless this Ceph deployment was compared to the manual one. For a production environment, one should really consider configuration management tools, such as Ansible, for deploying Ceph, to keep all the nodes at the same state from a configuration point of view. Also, they are very handy for managing large clusters with several tens of nodes.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.20.231