Skip to content

GlusterFS Volume Module

Sachidananda Urs edited this page Oct 30, 2017 · 8 revisions

glusterfs_volume - Create, delete, start, stop GlusterFS Volumes

Synopsis

  • Create, delete, start, and stop volumes
  • Volume options can be set and unset with this module
  • Supports multiple volume types: distribute, distribute-replicate, arbiter, etc.

Requirements

  • GlusterFS packages
  • Python 2.7 and above

Options

parameters required default choices comments
arbiter_count no Number of arbiter bricks to use
bricks yes Bricks that form the GlusterFS volume. The format of the bricks would be hostname:mountpoint/brick_dir alternatively user can provide just mountpoint/birck_dir, in such a case nodes variable has to be set
disperse_count Disperse count for the volume. If this value is specified, a dispersed volume will be created
force no yes / no Force option will be used while creating a volume, any warnings will be suppressed.
nodes no If the bricks are provided in host:brick format this field is not necessary. If the bricks are provided in mountpoint/brick_dir format nodes field is mandatory and one to one mapping is done between nodes and brick_dirs.
redundancy_count no Specifies the number of redundant bricks while creating a disperse volume. If redundancy count is missing an optimal value is computed.
replica_count 2 / 3 Replica count while creating a volume. Currently replica 2 and replica 3 are supported.
state yes present / absent / started / stopped / set If value is present volume will be created. If value is absent, volume will be deleted. If value is started, volume will be started. If value is stopped, volume will be stopped.
transport no tcp tcp / rdma / tcp,rdma The transport type for the volume.
name yes Name of the volume. Refer GlusterFS documentation for valid characters in a volume name.

Examples

  1. Create a replicate volume with two bricks
---
- hosts: master
  remote_user: root
  gather_facts: no

  tasks:
  - name: Creates a volume
    glusterfs_volume:
             state: present
             name: repvol
             bricks:
                - 10.70.42.25:/brick/rep
                - 10.70.43.142:/brick/rep
             transport: tcp
             replica_count: 2

  1. Delete a volume named repvol
---
- hosts: master
  remote_user: root
  gather_facts: no

  tasks:
  - name: Delete a volume
    volume:
             state: absent
             name: repvol
  1. Create a distributed volume
- hosts: master
  remote_user: root
  gather_facts: no

  tasks:
  - name: Creates a volume
    volume:
             state: present
             name: distvol
             bricks:
                - 10.70.42.25:/brick/rep
                - 10.70.43.142:/brick/rep
             transport: tcp
  1. Create a disperse volume with redundancy count 1
---
- hosts: master
  remote_user: root
  gather_facts: no

  tasks:
  - name: Creates a volume
    volume:
             state: present
             name: disp
             disperse: yes
             bricks:
                - 10.70.42.25:/brick/rep
                - 10.70.43.142:/brick/rep
                - 10.70.43.142:/redbrick/redun
             disperse_count: 2
             redundancy_count: 1
  1. Create a volume with transport type tcp,rdma
---
- hosts: master
  remote_user: root
  gather_facts: no

  tasks:
  - name: Creates a volume
    volume:
             state: present
             volume: glvol
             bricks:
                - 10.70.42.25:/brick/rep
                - 10.70.43.142:/brick/rep
             transport: tcp,rdma
  1. Start a volume
---
- hosts: master
  remote_user: root
  gather_facts: no

  tasks:
  - name: Start a volume
    volume:
             state: started
             name: repvol
  1. Stop a volume
---
- hosts: master
  remote_user: root
  gather_facts: no

  tasks:
  - name: Stop a volume
    volume:
             state: stopped
             name: repvol