Docker images for deploying ceph by ceph-ansible
337
Docker images for deploying ceph by ceph-ansible.
docker run -it --privileged=true -v "/home/docker-data:/home/" bugwz/ceph-ansible:16.0 /bin/bash
1. Init ansible env.
# Record remote host’s alias name
echo 192.168.10.31 node1 >> /etc/hosts
echo 192.168.10.32 node2 >> /etc/hosts
echo 192.168.10.33 node3 >> /etc/hosts
# Upload ssh connection key
sshpass -p $password ssh-copy-id -f -i ~/.ssh/id_rsa.pub node1
sshpass -p $password ssh-copy-id -f -i ~/.ssh/id_rsa.pub node2
sshpass -p $password ssh-copy-id -f -i ~/.ssh/id_rsa.pub node3
# Test ssh connection
ssh node1
ssh node2
ssh node3
2. Init ceph-ansible env.
git clone -b stable-6.0 https://github.com/ceph/ceph-ansible.git
cd ./ceph-ansible/
pip install -r requirements.txt
ansible-galaxy install -r requirements.yml
3. Init ceph-ansible deploy configs.
Create ceph cluster topo file. ( ./ceph-ansible/hosts )
cat > hosts <<EOF
[mgrs]
node1
node2
node3
[mons]
node1
node2
node3
[mdss]
node1
node2
node3
[osds]
node1
node2
node3
[clients]
node1
node2
node3
[rgws]
node1
node2
node3
[grafana-server]
node1
EOF
Ping ceph cluster node server. ( ./ceph-ansible/hosts )
ansible -i hosts -m ping all
Create ceph cluster config template file. ( ./ceph-ansible/group_vars/all.yml )
cat > group_vars/all.yml <<EOF
---
dummy:
configure_firewall: false
ceph_origin: repository
ceph_repository: community
ceph_mirror: https://mirrors.ustc.edu.cn/ceph
ceph_stable_key: https://mirrors.ustc.edu.cn/ceph/keys/release.asc
ceph_stable_release: pacific
ceph_stable_repo: "{{ ceph_mirror }}/rpm-{{ ceph_stable_release }}"
cephx: true
monitor_interface: eth0
public_network: 192.168.10.30/24
cluster_network: "{{ public_network }}"
osd_objectstore: bluestore
radosgw_civetweb_port: 80
radosgw_interface: eth0
dashboard_enabled: true
dashboard_admin_user: admin
dashboard_admin_password: admin123
dashboard_port: 8443
dashboard_network: "{{ public_network }}"
grafana_admin_user: admin
grafana_admin_password: admin123
no_log_on_ceph_key_tasks: false
EOF
Create ceph cluster component config template file. ( ./ceph-ansible/group_vars/[mons/mgrs/mdss/rgws/clients/osds].yml )
cat > group_vars/mons.yml <<EOF
---
dummy:
EOF
cat > group_vars/mgrs.yml <<EOF
---
dummy:
EOF
cat > group_vars/mdss.yml <<EOF
---
dummy:
EOF
cat > group_vars/rgws.yml <<EOF
---
dummy:
EOF
cat > group_vars/clients.yml <<EOF
---
dummy:
EOF
cat > group_vars/osds.yml <<EOF
---
dummy:
devices:
- /dev/sdb
EOF
Create ceph-ansible deploy step file. ( ./ceph-ansible/site.yml )
cp site.yml.sample site.yml
4. Start deploy.
# Deploy
ansible-playbook -vvv -i hosts site.yml
# Destroy and clean up
ansible-playbook -vvv -i hosts infrastructure-playbooks/purge-cluster.yml
Ceph-Pacific.repo
[ceph]
name=Ceph packages for $basearch
baseurl=https://mirrors.aliyun.com/ceph/rpm-pacific/el8/$basearch
enabled=1
priority=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/ceph/keys/release.asc
[ceph-noarch]
name=Ceph noarch packages
baseurl=https://mirrors.aliyun.com/ceph/rpm-pacific/el8/noarch
enabled=1
priority=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/ceph/keys/release.asc
[ceph-source]
name=Ceph source packages
baseurl=https://mirrors.aliyun.com/ceph/rpm-pacific/el8/SRPMS
enabled=0
priority=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/ceph/keys/release.asc
[ceph-packages]
name=Ceph packages
baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/storage/$basearch/ceph-pacific/
gpgcheck=0
priority=1
Dockerfile:
FROM roboxes/centos8:latest
COPY ./Ceph-Pacific.repo /etc/yum.repos.d/Ceph-Pacific.repo
RUN mv /etc/yum.repos.d/CentOS-Linux-BaseOS.repo /etc/yum.repos.d/CentOS-Base.repo.backup \
&& wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo \
&& dnf clean all \
&& dnf install -y epel-release kernel-headers \
&& dnf groupinstall -y 'development tools' \
&& dnf install -y git python2 python36 python38 python2-devel python36-devel python38-devel snappy csnappy csnappy-devel sshpass \
&& dnf reinstall -y kernel-headers csnappy-devel \
&& /usr/bin/python3.6 -m pip install --upgrade pip \
&& rm -rf /usr/bin/python /usr/bin/pip \
&& ln -s /usr/bin/python3.6 /usr/bin/python \
&& ln -s /usr/local/bin/pip3.6 /usr/bin/pip \
&& echo "export PATH=/usr/bin/:\$PATH" >> /etc/bashrc
RUN mkdir -p /root/ansible \
&& pip install wheel \
&& pip install https://github.com/ansible/ansible/archive/v2.10.7.tar.gz \
&& pip install ansible==2.10.7
RUN rm -rf ~/.ssh/id_rsa \
&& ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa
Content type
Image
Digest
sha256:665a1dea9…
Size
753.6 MB
Last updated
over 3 years ago
docker pull bugwz/ceph-ansible