gluster_volume module problem

Dear Taneli, Ansible list,

I started using the new gluster_volume module which was released as part of ansible 1.9. It comes right on time for me. Thank you for your efforts maintaining the project and delivering new functionality. Unfortunately I seem to be running into a problem with it every time I try to create a brand new GlusterFS volume and cluster. It seems like the actual underlying operation does succeed since the glusterfs volume is created successfully and everything seems to be fine when I check on the command line but the playbook operation returns and error and the playbook terminates.

Here’s the error message that I get:

failed: [host1] => {“failed”: true, “parsed”: false}
OpenSSH_5.9p1, OpenSSL 0.9.8za 5 Jun 2014
debug1: Reading configuration data /Users/rumen/.ssh/config
debug1: /Users/rumen/.ssh/config line 41: Applying options for *
debug1: /Users/rumen/.ssh/config line 80: Applying options for *
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 55: Applying options for *
debug1: auto-mux: Trying existing master
debug1: mux_client_request_session: master session id: 2
Traceback (most recent call last):
File “”, line 2009, in
File “”, line 406, in main
TypeError: ‘bool’ object is not callable

FATAL: all hosts have already failed – aborting

​Ansible playbook gluster_volume​ snippet:

  • name: glusterfs volume
    run_once: true
    gluster_volume: state=present name=brain rebalance=yes transport=tcp start_on_create=yes host={{
    ​proj​
    _hostname }}
    brick=/
    ​path/to​
    /brick
    replicas={{
    ​proj​
    _hostnames_array|length }}
    cluster={{
    ​proj​
    _hostnames }}
    options=“{ ‘nfs.disable’:‘on’, ‘network.ping-timeout’:‘5’, ‘storage.health-check-interval’:‘5’, ‘auth.allow’:‘{{
    ​proj​
    _hostnames }}’ }”

Variables above expand to:

proj_hostname = ‘host1’ # string: current host running this run_once job
proj_hostname = ‘host1,host2,host3’ # string: all three hosts participating in the cluster

proj_hostnames_array = [ ‘host1’, ‘host2’, ‘host3’ ]​ # array: same as above, but an array of strings

​Also worth mentioning that subsequent reruns of the same playbook are fine and report no errors and no changes. So again, the underlying action has been successful.

​Please let me know if I could provide any additional details.

Your help is appreciated.​

​Regards,​

For what is worth, changing any option to an already established volume results in the same behavior.

Answering my own question, hopefully will help someone else who might encounter this. I spent some time looking into this:

File “”, line 406, in main

is actually:

if rebalance:
rebalance(volume_name)

which in turn runs:

def rebalance(name):
run_gluster([‘volume’, ‘rebalance’, name, ‘start’])

effectively resulting in:

gluster volume rebalance brain start

volume rebalance: brain: failed: Volume brain is not a distribute volume or contains only 1 brick. Not performing rebalance

echo $?

1

There’s no need to rebalance anything in my cluster configuration (3 x 1 mirrors, no distribution). Removing rebalance=yes from my task causes the problem to go away for me.

Nevertheless I think the module should catch this case and handle it gracefully.

Regards,

see if this PR fixes the issues also (at least the reporting):
https://github.com/ansible/ansible-modules-extras/pull/356

Brian,

Thank you for looking into this. I tried the patched file (https://raw.githubusercontent.com/bcoca/ansible-modules-extras/4c0b1b42bc79634052b69557fc804f13e9557669/system/gluster_volume.py) and it seems like it’s not quite there yet. Here are the problems that I got:

File “”, line 143
return out
^
SyntaxError: invalid syntax

You’re missing a closing ‘)’ on gluster_volume.py:143

module.fail_json(msg=‘error running gluster (%s) command: %s’ % (’ '.join(args), str(e))

After closing the bracket the next run yields:

File “”, line 2022, in
File “”, line 340, in main
File “”, line 162, in get_peers
File “”, line 135, in run_gluster
NameError: global name ‘glusterbin’ is not defined

I’ll leave it here for you to revisit the code.

Thank you,

Rumen Telbizov

I saw that a few minutes later, its already patched in current devel.

I assume the diff you’re talking about is https://github.com/ansible/ansible-modules-extras/commit/7794042cf65b075c9ca9bf4248df994bff94401f#diff-8e371bac3b1b27de2e05cbc0fd4e69aa

Like I mentioned closing the bracket is one thing but after then I ran into:

File “”, line 135, in run_gluster
NameError: global name ‘glusterbin’ is not defined

Not sure if this is because I am not running the latest devel branch but 1.9.0.1 instead?

yes, try current devel, there are other changes that that patch won't
fix against 1.9.0.1

Hi,

just had the same issue using 1.9.0.1. As Rumen mentioned, only crashes at the first run. Tested it several times destroying and starting Vagrants.

Oriol

BTW here’s my code [1] although workaround was removing rebalance=yes as for now.

[1] https://github.com/wefner/ansible-vagrant/blob/develop/adv/code/roles/glusterfs/tasks/main.yml#L78