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.
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
EOFDisable firewall and SELinux
systemctl stop firewalld && systemctl disable firewalld
setenforce 0 && sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/configSet hostnames on each node
hostnamectl set-hostname node1
hostnamectl set-hostname node2
hostnamectl set-hostname node3Configure time synchronization
systemctl restart chronyd.service && systemctl enable chronyd.serviceSet 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 node3Install pip, Ansible and Git
yum install python-pip ansible git -yDeploy Ceph Cluster
Clone the repository
git clone https://github.com/ceph/ceph-ansible.git
cd ceph-ansible
git checkout stable-4.0Install Ansible dependencies
pip install --upgrade pip
pip install -r requirements.txtUpdate 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
EOFBackup group_vars YAML files
cd ceph-ansible/group_vars
for file in *; do cp $file ${file%.*}; doneModify 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: TrueModify group_vars/osds.yml
devices:
- /dev/sdbEdit site.yml (illustrated below)
Start installation
ansible-playbook -i /etc/ansible/hosts site.ymlThe 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 onResult screenshots:
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
