简体   繁体   中英

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.

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).

I'm trying to use the official gluster-ansible-role ( https://github.com/gluster/gluster-ansible-infra ) to prepare the backend disks (/dev/vdb). My aim is to:

  1. Create a volume group 'storage_vg' which contains /dev/vdb as the physical volume.
  2. Create a logical volume 'storage_lv' from 'storage_vg'.
  3. Create a XFS file system on 'storage_lv' and mount it under /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/

Details of how this was resolved can be seen here: 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.

  2. The size variable needs to be set under gluster_infra_thick_lvs

  3. On Debian (Buster), xfsprogs needs to be installed.

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'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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