Operations 5 min read

Step-by-Step Guide: Deploy a Ceph Storage Cluster on CentOS 7 with Ansible

This tutorial walks you through configuring three CentOS 7.9 nodes, disabling firewalls, setting hostnames, enabling time sync, establishing password‑less SSH, installing required packages, and using Ansible to clone, configure, and deploy a Ceph Nautilus cluster in about ten minutes.

Ops Development Stories
Ops Development Stories
Ops Development Stories
Step-by-Step Guide: Deploy a Ceph Storage Cluster on CentOS 7 with Ansible

Deploy Ceph Cluster

Three machines running CentOS 7.9 are prepared; the following steps must be executed on each node.

Configure hosts resolution

cat >> /etc/hosts <<EOF
192.168.2.23 node1
192.168.2.24 node2
192.168.2.25 node3
EOF

Disable firewall and SELinux

systemctl stop firewalld && systemctl disable firewalld
setenforce 0 && sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

Set hostnames on each node

hostnamectl set-hostname node1
hostnamectl set-hostname node2
hostnamectl set-hostname node3

Configure time synchronization

systemctl restart chronyd.service && systemctl enable chronyd.service

Set up password‑less SSH

ssh-keygen
ssh-copy-id -i .ssh/id_rsa.pub node1
ssh-copy-id -i .ssh/id_rsa.pub node2
ssh-copy-id -i .ssh/id_rsa.pub node3

Install pip, Ansible and Git

yum install python-pip ansible git -y

Deploy Ceph Cluster

Clone the repository

git clone https://github.com/ceph/ceph-ansible.git
cd ceph-ansible
git checkout stable-4.0

Install Ansible dependencies

pip install --upgrade pip
pip install -r requirements.txt

Update Ansible hosts file

cat >> /etc/ansible/hosts <<EOF
[mons]
node1
node2
node3

[osds]
node1
node2
node3

[mgrs]
node1

[mdss]
node1
node2
node3

[clients]
node1
node2
node3

[rgws]
node1
node2
node3

[grafana-server]
node1
EOF

Backup group_vars YAML files

cd ceph-ansible/group_vars
for file in *; do cp $file ${file%.*}; done

Modify group_vars/all.yml

---
dummy:
  mon_group_name: mons
  osd_group_name: osds
  rgw_group_name: rgws
  mds_group_name: mdss
  client_group_name: clients
  mgr_group_name: mgrs
  grafana_server_group_name: grafana-server
  configure_firewall: False
  ceph_origin: repository
  ceph_repository: community
  ceph_mirror: //mirrors.aliyun.com/ceph
  ceph_stable_key: //mirrors.aliyun.com/ceph/keys/release.asc
  ceph_stable_release: nautilus
  ceph_stable_repo: "{{ ceph_mirror }}/rpm-{{ ceph_stable_release }}"
  public_network: "192.168.2.0/24"
  cluster_network: "192.168.2.0/24"
  monitor_interface: ens33
  osd_auto_discovery: true
  osd_objectstore: filestore
  radosgw_interface: ens33
  dashboard_admin_password: asd123456
  grafana_admin_password: admin
  pg_autoscale_mode: True

Modify group_vars/osds.yml

devices:
  - /dev/sdb

Edit site.yml (illustrated below)

site.yml configuration
site.yml configuration

Start installation

ansible-playbook -i /etc/ansible/hosts site.yml

The process finishes in about ten minutes.

After installation, a warning appears because pg_autoscale_mode was set to False in all.yml. Enable it manually:

ceph osd pool set <pool-name> pg_autoscale_mode on

Result screenshots:

Ceph status 1
Ceph status 1
Ceph status 2
Ceph status 2
Ceph status 3
Ceph status 3
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

storageCephCluster DeploymentCentOSAnsible
Ops Development Stories
Written by

Ops Development Stories

Maintained by a like‑minded team, covering both operations and development. Topics span Linux ops, DevOps toolchain, Kubernetes containerization, monitoring, log collection, network security, and Python or Go development. Team members: Qiao Ke, wanger, Dong Ge, Su Xin, Hua Zai, Zheng Ge, Teacher Xia.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.