Deploy ceph cluster using ansible

Basic configuration

The three environments are centos7.9, and the following configuration needs to be executed on each machine

Configure hosts resolution

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

Turn off the firewall and selinux

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

Set the host name on the three nodes respectively

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

Configure host time synchronization

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

Configure password-free login

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 and ansible, git

yum install python-pip ansible git -y

Deploy ceph cluster

Clone the repository

Here I choose to install the ceph nautilus version

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

Install ansible dependency package

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

Modify the hosts file, add installed nodes

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

Back up the yml file under group_vars

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

Modify group_vars/all.yml configuration

---
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_origin: repository
ceph_repository: community
ceph_mirror: http://mirrors.aliyun.com/ceph
ceph_stable_key: http://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 the group_vars/osds.yml configuration

devices:
  - /dev/sdb

Modify site.yml configuration
image.png

Start the installation

Leave the rest to the time, it will be installed in about ten minutes

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

Check the installation status and found a warning. This is because the previous all.yml configuration is not enabled to allow automatic adjustment of the number of pgs in the pool. You pg_autoscale_mode: Falsecan manually set

ceph osd pool set <pool-name> pg_autoscale_mode on

image.png
image.png
image.png


Welcome to follow the personal public account "Operation and maintenance development story"
Deploy ceph cluster using ansible

Guess you like

Origin blog.51cto.com/12970189/2603435