使用 Ansible 设置 GlusterFS 集群

Setting up GlusterFS cluster using Ansible

我正在尝试使用 Ansible 设置一个 3 节点 GlusterFS 集群,并且 运行 在尝试设置后端存储时遇到了一些问题。

我当前的设置包含 3 个节点,除了主存储 (/dev/vda) 之外,每个节点都附加了一个 10G 磁盘 (/dev/vdb)。

我正在尝试使用官方的 gluster-ansible-role (https://github.com/gluster/gluster-ansible-infra) 来准备后端磁盘 (/dev/vdb)。我的目标是:

  1. 创建一个包含 /dev/vdb 作为物理卷的卷组 'storage_vg'。
  2. 从 'storage_vg' 创建一个逻辑卷 'storage_lv'。
  3. 在'storage_lv'上创建一个XFS文件系统并挂载在/mnt/brick

我的剧本如下:

- hosts: all
  become: True
  roles:
    - gluster.infra
  vars:
    gluster_infra_fw_state: disabled
    gluster_infra_volume_groups:
      vgname: 'storage_vg'
      pvname: '/dev/vdb'
    gluster_infra_thick_lvs:
      vgname: 'storage_vg'
      lvname: 'storage_lv'
    gluster_infra_mount_devices:
      path: '/mnt/brick'
      vgname: 'storage_vg'
      lv: 'storage_lv'

剧本失败并出现以下错误:

TASK [gluster.infra/roles/backend_setup : Group devices by volume group name, including existing devices] ******************************************************************
fatal: [gluster-node1]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'str object' has no attribute 'vgname'\n\nThe error appears to be in '/root/.ansible/roles/gluster.infra/roles/backend_setup/tasks/get_vg_groupings.yml': line 3, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Group devices by volume group name, including existing devices\n  ^ here\n"}

我已经在此处上传了完整的日志文件https://paste.ubuntu.com/p/dGPD7KRPMF/

有关如何解决此问题的详细信息,请参见此处:https://github.com/gluster/gluster-ansible-infra/issues/70

必须进行一些更改才能使其正常工作。

  1. 开发人员建议使用 1.0.4 分支而不是默认分支。

  2. 需要在gluster_infra_thick_lvs

  3. 下设置size变量
  4. 在 Debian (Buster) 上,需要安装 xfsprogs

这是我的工作手册。

---
- hosts: all
  become: True
  roles:
    - gluster.infra
  vars:
    gluster_infra_fw_state: disabled
    gluster_infra_volume_groups:
      - vgname: 'storage_vg'
        pvname: '/dev/vdb'
    gluster_infra_thick_lvs:
      - vgname: 'storage_vg'
        lvname: 'storage_lv'
        pvs: '/dev/vdb'
        size: '100%FREE'
    gluster_infra_mount_devices:
      - path: '/mnt/brick'
        vgname: 'storage_vg'
        lvname: 'storage_lv'