This fork updates the playbook to work with GlusterFS version 11, whose cli syntax has changed. Volume creation has been tested, including for idempotence, on Ubuntu.
The brick syntax has also changed. Before, you specified just the brick you were
adding on the host, like gluster_cluster_bricks: "/mnt/gluster/brick_name"
But now you must specify all the full path of all the bricks like this:
gluster_cluster_bricks: "10.10.10.10:/mnt/gluster/brick_name 10.10.10.11:/mnt/gluster/brick_name"
During the volume creation process, gluster will create the relevant directories on all the hosts. This means that if gluster is already installed when you add a new volume, it'll set it up for you on all the relevant hosts, regardless of which one you run the playbook on.
This role helps the user to set up a GlusterFS cluster, manage gluster volumes and peer operations. The gluster.cluster role has multiple sub-roles which are invoked depending on the variables that are set. The sub-roles are:
- gluster_volume - manage gluster volumes(create, delete, start, stop, set)
- gluster_brick - perform add/remove/replace operations on existing bricks
- Ansible version 2.5 or above.
- GlusterFS version 11 or above.
These are the superset of role_varibles. They are explained further in the respective sub-roles directory.
Name | Choices | Default value | Comments |
---|---|---|---|
gluster_cluster_arbiter_count | UNDEF | Number of arbiter bricks to use (Only for arbiter volume types). | |
gluster_cluster_bricks | UNDEF | 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 gluster_hosts variable has to be set | |
gluster_cluster_disperse_count | UNDEF | Disperse count for the volume. If this value is specified, a dispersed volume will be created | |
gluster_cluster_force | yes / no | no | Force option will be used while creating a volume, any warnings will be suppressed. |
gluster_cluster_hosts | Contains the list of hosts that have to be peer probed. | ||
gluster_cluster_redundancy_count | UNDEF | Specifies the number of redundant bricks while creating a disperse volume. If redundancy count is missing an optimal value is computed. | |
gluster_cluster_replica_count | 2 / 3 | UNDEF | Replica count while creating a volume. Currently replica 2 and replica 3 are supported. |
gluster_cluster_state | present / absent / started / stopped / set | present | 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. |
gluster_cluster_transport | tcp / rdma / tcp,rdma | tcp | The transport type for the volume. |
gluster_cluster_volume | glustervol | Name of the volume. Refer GlusterFS documentation for valid characters in a volume name. |
Name | Choices | Default value | Comments |
---|---|---|---|
gluster_cluster_new_bricks | UNDEF | Contains the list of bricks along with the new bricks to be added to the GlusterFS volume. The format of the bricks is mountpoint/brick_dir | |
gluster_cluster_hosts | UNDEF | Contains the list of hosts that have to be peer probed. | |
gluster_cluster_volume | glustervol | Name of the volume. Refer GlusterFS documentation for valid characters in a volume name. | |
gluster_cluster_remove_bricks | UNDEF | Contains the list of bricks to be removed. |
Create a GlusterFS volume and set specific options.
---
- name: Create Gluster cluster
hosts: gluster_servers
remote_user: root
gather_facts: false
vars:
# gluster volume
gluster_cluster_hosts:
- 10.70.41.212
- 10.70.42.156
gluster_cluster_volume: testvol
gluster_cluster_transport: 'tcp'
gluster_cluster_force: 'yes'
gluster_cluster_bricks: '/mnt/brick1/store,/mnt/brick2/store'
# variables to create specific type of the volume
gluster_cluster_replica_count: 2
# variables to set specific volume options
gluster_cluster_options: {'performance.cache-size':'256MB'}
roles:
- gluster.cluster
GPLv3