简体   繁体   English

使用Ansible设置GlusterFS集群

[英]Setting up GlusterFS cluster using Ansible

I'm trying to setup a 3 node GlusterFS cluster using Ansible and have run into some issues trying to setup the backend storage. 我正在尝试使用Ansible设置3节点GlusterFS集群,并且在尝试设置后端存储时遇到了一些问题。

My current setup consists of 3 nodes, each of which has a 10G disk attached (/dev/vdb) in addition to the primary storage (/dev/vda). 我当前的设置包括3个节点,每个节点除了主存储(/ dev / vda)之外还附加了10G磁盘(/ dev / vdb)。

I'm trying to use the official gluster-ansible-role ( https://github.com/gluster/gluster-ansible-infra ) to prepare the backend disks (/dev/vdb). 我正在尝试使用官方的gluster-ansible-role( https://github.com/gluster/gluster-ansible-infra )准备后端磁盘(/ dev / vdb)。 My aim is to: 我的目标是:

  1. Create a volume group 'storage_vg' which contains /dev/vdb as the physical volume. 创建一个卷组“ storage_vg”,其中包含/ dev / vdb作为物理卷。
  2. Create a logical volume 'storage_lv' from 'storage_vg'. 从“ storage_vg”创建逻辑卷“ storage_lv”。
  3. Create a XFS file system on 'storage_lv' and mount it under /mnt/brick 在“ storage_lv”上创建XFS文件系统,并将其挂载在/ mnt / brick下

My playbook is as follows: 我的剧本如下:

- 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'

The playbook fails with the following error: 该剧本因以下错误而失败:

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"}

I've uploaded the full log file here https://paste.ubuntu.com/p/dGPD7KRPMF/ 我已经将完整的日志文件上传到了这里https://paste.ubuntu.com/p/dGPD7KRPMF/

Details of how this was resolved can be seen here: https://github.com/gluster/gluster-ansible-infra/issues/70 有关如何解决此问题的详细信息,请参见此处: https : //github.com/gluster/gluster-ansible-infra/issues/70

A few changes had to be done to get this to work. 为了使它起作用,必须进行一些更改。

  1. There was a suggestion by the developers to use the 1.0.4 branch instead of the default branch. 开发人员建议使用1.0.4分支而不是默认分支。

  2. The size variable needs to be set under gluster_infra_thick_lvs size变量需要在gluster_infra_thick_lvsgluster_infra_thick_lvs

  3. On Debian (Buster), xfsprogs needs to be installed. 在Debian(Buster)上,需要安装xfsprogs

Here's my working playbook. 这是我的工作手册。

---
- 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'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM