# gluster\_volume module problem

**URL:** <https://forum.ansible.com/t/gluster-volume-module-problem/17862>\
**Category:** Ansible Project\
**Created:** [March 27, 2015, 9:32pm UTC](https://forum.ansible.com/t/gluster-volume-module-problem/17862 "2015-03-27T21:32:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rumen\_Telbizov](https://avatars.discourse-cdn.com/v4/letter/r/d6d6ee/32.png) [@Rumen\_Telbizov](https://forum.ansible.com/u/Rumen_Telbizov)\
**Post date:** [March 27, 2015, 9:32pm UTC](https://forum.ansible.com/t/gluster-volume-module-problem/17862/1 "2015-03-27T21:32:23Z")

</div>

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,​

---

<div class="post-metadata">

**Author:** ![Rumen\_Telbizov](https://avatars.discourse-cdn.com/v4/letter/r/d6d6ee/32.png) [@Rumen\_Telbizov](https://forum.ansible.com/u/Rumen_Telbizov)\
**Post date:** [March 27, 2015, 10:52pm UTC](https://forum.ansible.com/t/gluster-volume-module-problem/17862/2 "2015-03-27T22:52:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rumen\_Telbizov](https://avatars.discourse-cdn.com/v4/letter/r/d6d6ee/32.png) [@Rumen\_Telbizov](https://forum.ansible.com/u/Rumen_Telbizov)\
**Post date:** [March 30, 2015, 11:28pm UTC](https://forum.ansible.com/t/gluster-volume-module-problem/17862/3 "2015-03-30T23:28:36Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [March 31, 2015, 12:16am UTC](https://forum.ansible.com/t/gluster-volume-module-problem/17862/4 "2015-03-31T00:16:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rumen\_Telbizov](https://avatars.discourse-cdn.com/v4/letter/r/d6d6ee/32.png) [@Rumen\_Telbizov](https://forum.ansible.com/u/Rumen_Telbizov)\
**Post date:** [March 31, 2015, 6:00pm UTC](https://forum.ansible.com/t/gluster-volume-module-problem/17862/5 "2015-03-31T18:00:45Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [March 31, 2015, 6:05pm UTC](https://forum.ansible.com/t/gluster-volume-module-problem/17862/6 "2015-03-31T18:05:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rumen\_Telbizov](https://avatars.discourse-cdn.com/v4/letter/r/d6d6ee/32.png) [@Rumen\_Telbizov](https://forum.ansible.com/u/Rumen_Telbizov)\
**Post date:** [March 31, 2015, 6:16pm UTC](https://forum.ansible.com/t/gluster-volume-module-problem/17862/7 "2015-03-31T18:16:53Z")

</div>

I assume the diff you’re talking about is [https://github.com/ansible/ansible-modules-extras/commit/7794042cf65b075c9ca9bf4248df994bff94401f#diff-8e371bac3b1b27de2e05cbc0fd4e69aa](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?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [March 31, 2015, 6:28pm UTC](https://forum.ansible.com/t/gluster-volume-module-problem/17862/8 "2015-03-31T18:28:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Oriol\_Fabregas](https://avatars.discourse-cdn.com/v4/letter/o/dbc845/32.png) [@Oriol\_Fabregas](https://forum.ansible.com/u/Oriol_Fabregas)\
**Post date:** [April 22, 2015, 10:36pm UTC](https://forum.ansible.com/t/gluster-volume-module-problem/17862/9 "2015-04-22T22:36:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Oriol\_Fabregas](https://avatars.discourse-cdn.com/v4/letter/o/dbc845/32.png) [@Oriol\_Fabregas](https://forum.ansible.com/u/Oriol_Fabregas)\
**Post date:** [April 23, 2015, 6:57am UTC](https://forum.ansible.com/t/gluster-volume-module-problem/17862/10 "2015-04-23T06:57:49Z")

</div>

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](https://github.com/wefner/ansible-vagrant/blob/develop/adv/code/roles/glusterfs/tasks/main.yml#L78)
