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.
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.
There are two ways you can deploy Ceph using the ceph-ansible
modules:
ceph-ansible
module to first launch a few virtual machines using Vagrant and VirtualBox/VMware, and then install and configure Ceph using Ansible.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.
ceph-ansible
module:$ git clone https://github.com/ceph/ceph-ansible.git $ cd ceph-ansible
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
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.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
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
mon0
node and check your cluster status:$ vagrant ssh mon0 $ sudo ceph -s
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.
18.118.20.231