在 CentOS 8 上使用 Ansible 安装 Ceph 可以通过以下步骤来实现:
步骤 1: 准备 Ansible 环境
确保你的管理机器上已经安装了 Ansible。如果未安装,可以使用以下命令来安装:
sudo dnf install ansible
步骤 2: 创建 Inventory 文件
创建一个名为 hosts
的 Inventory 文件,以定义目标主机(即将成为 Ceph 集群的节点)。例如:
[ceph_nodes]
192.168.1.101 ansible_user=your_username ansible_ssh_private_key_file=/path/to/your/key
192.168.1.102 ansible_user=your_username ansible_ssh_private_key_file=/path/to/your/key
192.168.1.103 ansible_user=your_username ansible_ssh_private_key_file=/path/to/your/key
步骤 3: 使用 ceph-ansible
你可以使用 ceph-ansible 这个专门的 Ansible 项目来安装 Ceph。首先,需要从 GitHub 克隆 ceph-ansible 仓库:
git