DEV Community

Ajinkya Ingole
Ajinkya Ingole

Posted on

Deploying docker-based CEPH cluster using ceph-ansible

Why Docker and Ceph?

● Stateless containers
● Stateful data
● Location independent access
● Robust access protocols
● Massively scalable
● Open source

Install ansible

For installing ansible and configuring secret-free login between nodes, this is not covered here. Please refer to Official Documents at https://docs.ansible.com/
Releases
The following branches should be used depending on your requirements. The stable-* branches have been QE tested and sometimes recieve backport fixes throughout their lifecycle. The master branch should be considered experimental and used with caution.

stable-3.0 Supports Ceph versions jewel and luminous. This branch requires Ansible version 2.4.
stable-3.1 Supports Ceph versions luminous and mimic. This branch requires Ansible version 2.4.
stable-3.2 Supports Ceph versions luminous and mimic. This branch requires Ansible version 2.6.
stable-4.0 Supports Ceph version nautilus. This branch requires Ansible version 2.8.
stable-5.0 Supports Ceph version octopus. This branch requires Ansible version 2.9.
master Supports the master branch of Ceph. This branch requires Ansible version 2.9.

Download ceph-ansible

git clone https://github.com/ceph/ceph-ansible.git
cd ceph-ansible
# Refer to the official document of ceph-ansible http://docs.ceph.com/ceph-ansible/master for branch instructions.
# stable-3.1 Support for Ceph version luminous and mimic. This branch supports Ansible version 2.4.
git checkout stable-3.1

Configure ceph-ansible

cp group_vars/all.yml.sample group_vars/all.yml
cp group_vars/osds.yml.sample group_vars/osds.yml
cp site-docker.yml.sample site-docker.yml

Edit the group_vars/all.yml file. The following information should be adapted according to the actual situation.

generate_fsid: true
monitor_interface: eth0
journal_size: 5120
public_network: 10.0.0.0/24
cluster_network: 10.0.0.0/24
ceph_docker_image: "ceph/daemon"
ceph_docker_image_tag: latest-mimic
containerized_deployment: true
ceph_docker_registry: docker.io
radosgw_interface: eth0

Edit the group_vars/osds.yml file. The following information should be adapted according to the actual situation.

osd_scenario: collocated
devices:
  - /dev/xvdb
  - /dev/xvdc
  - /dev/xvdc

Edit the hosts file /etc.ansible/hosts, the following information should be adapted according to the actual situation.

[mons]
ip-10-0-0-80.ec2.internal

[mgrs]
ip-10-0-0-80.ec2.internal

[osds]
ip-10-0-0-80.ec2.internal 

[rgws]
ip-10-0-0-80.ec2.internal 

Start deployment
If the following command fails, the log file defaults to / var/log/ansible.log, you can refer to the error log for processing. (Note: During deployment, docker will be installed by default on each node. This step script does not determine whether the current machine has docker installed. If the target machine has docker installed, there may be errors. The solution is to comment out the corresponding steps to install docker. The corresponding contents are roles/ceph-docker-common/tasks/pre_requisites/pre requisites. Ites.yml.)

ansible-playbook site-docker.yml

Output:

docker ps
docker exec d77bd7f96bfe ceph -s

alt text

I hope that you have understood how to deploy ceph in docker using ansible.

Happy Cephing!!

Oldest comments (0)