Announcing Ansible playbooks for Ceph!
Ceph: cow based deployment with Ansible :-).
I am delighted to announce that I achieved the Ansible playbook to deploy Ceph.
I. The playbook
The playbook is available on the Ceph Github.
What does it do?
- Authentication (cephx), this can be disabled.
- Supports cluster public and private network.
- Monitors deployment. You can easily start with one monitor and then progressively add new nodes. So can deploy one monitor for testing purpose. For production, I recommend to always use an odd number of monitors, 3 tends to be the standard.
- Object Storage Daemons. Like the monitors you can start with a certain amount of nodes and then grow this number. The playbook either supports a dedicated device for storing the journal or both journal and OSD data on the same device (using a tiny partition at the beginning of the device).
- Metadata daemons.
- Collocation. The playbook supports collocating Monitors, OSDs and MDSs on the same machine.
- The playbook was validated on both Debian Wheezy and Ubuntu 12.04 LTS.
- Tested on Ceph Dumpling and Emperor.
- A rolling upgrade playbook was written, an upgrade from Dumpling to Emperor was performed and worked.
What not supported?
- The Rados gateway is not implemented since someone already did it here: https://github.com/jcftang/ansible-ceph, I just hope that we can mix them in a near futur.
II. Setup with Vagrant
I know that Vagrant has an Ansible prosionning provider, however I thought this was way to much automation. I believe that you need to put your hands on it otherwise you will not be able to perform any other deployment (specially if it is your first time with Ansible).
First modify the rc
file we your home directory:
export ANSIBLE_CONFIG=<whatever_path>/.ansible.cfg
Do the same for the .ansible.cfg
file:
[defaults]
host_key_checking = False
remote_user = vagrant
hostfile = <whatever_path>/hosts
log_path = <whatever_path>/ansible.log
ansible_managed = Ansible managed: modified on %Y-%m-%d %H:%M:%S by {uid}
private_key_file = ~/.vagrant.d/insecure_private_key
error_on_undefined_vars = False
Edit your /etc/hosts
file with:
# Ansible hosts
127.0.0.1 ceph-mon0
127.0.0.1 ceph-mon1
127.0.0.1 ceph-mon2
127.0.0.1 ceph-osd0
127.0.0.1 ceph-osd1
127.0.0.1 ceph-osd2
Now since we use Vagrant and port forwarding, don’t forget to grab the SSH local port of your VMs.
Then edit your hosts
file accordingly.
Ok let’s get serious now. Run your virtual machines:
$ vagrant up |
Test if Ansible can access the virtual machines:
$ ansible all -m ping |
Ready to deploy? Let’s go!
$ ansible-playbook -f 6 -v site.yml |
Check the status:
$ vagrant ssh mon0 -c "sudo ceph -s" |
Quick note about distro support. This playbook has been tested on both Debian Wheezy and Ubuntu.
I sincerely hope that you will enjoy this playbook :).
Comments