# gluster\_volume module

**URL:** <https://forum.ansible.com/t/gluster-volume-module/18674>\
**Category:** Ansible Project\
**Created:** [July 4, 2015, 3:30am UTC](https://forum.ansible.com/t/gluster-volume-module/18674 "2015-07-04T03:30:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Goodness](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@Michael\_Goodness](https://forum.ansible.com/u/Michael_Goodness)\
**Post date:** [July 4, 2015, 3:30am UTC](https://forum.ansible.com/t/gluster-volume-module/18674/1 "2015-07-04T03:30:43Z")

</div>

Greetings, Ansiblites!

I’m attempting to write a role that uses the gluster\_volume module. All is well right up until I try to specify an ‘options’ parameter. According to the documentation, I’m to use “a dictionary/hash with options/settings for the volume”. The example given is as follows:

> gluster\_volume: state=present name=test1 options=‘{performance.cache-size: 256MB}’

I’ve matched that syntax in my playbook, and all I get is a complaint from Ansible about quoting. I’ve tried just about every variation of quoting I can think of: single, double, double-double, escaped, etc… The closest I (think) have gotten is by specifying the options as a variable, then single-quoting the expansion:

> # file: group\_vars/gluster\_hosts
> 
> …  
> options: { group: virt, storage.owner\_uid: 36, storage.owner\_gui: 36 }  
> …

> # file: roles/gluster/tasks/main.yml
> 
> …  
> gluster\_volume: name={{ name }} options=‘{{ options }}’ state=present  
> …

Even then, the result is:

> msg: unable to evaluate dictionary for options

Can anyone shed some light on this? I’m at my wit’s end.

---

<div class="post-metadata">

**Author:** ![Michael\_Goodness](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@Michael\_Goodness](https://forum.ansible.com/u/Michael_Goodness)\
**Post date:** [July 4, 2015, 3:52am UTC](https://forum.ansible.com/t/gluster-volume-module/18674/2 "2015-07-04T03:52:09Z")

</div>

Well, apparently I hadn’t tried everything yet. I was able to get a successful run by including the options parameter in the creation task, rather than keeping them separate. I also had to double-quote the expansion in my playbook, and single-quote the integers in my variable dictionary:

> # file: group\_vars/gluster\_hosts
> 
> …  
> options: { group: virt, storage.owner-uid: ‘36’, storage.owner-gid: ‘36’ }  
> …

(Note the corrections to owner-uid and owner-gid.)

> # file: roles/gluster/tasks/main.yml
> 
> …
> 
> - name: Create gluster volumes  
> sudo: true  
> gluster\_volume:  
> name={{ item.name }}  
> brick=“{% for brick in item.bricks %}{{ brick.mount }}/{{ item.name }}{% if not loop.last %},{% endif %}{% endfor %}”  
> cluster=“{{ groups.gluster\_hosts|join(‘,’) }}”  
> options=“{{ item.options }}”  
> state=present  
> with\_items: gluster\_volumes  
> tags: gluster  
> …

Seems like there’s a bug in the module, and the documentation is definitely incorrect. I’ll experiment more and see if I can offer a fix.

---

<div class="post-metadata">

**Author:** ![Chris\_Weeks](https://avatars.discourse-cdn.com/v4/letter/c/97f17d/32.png) [@Chris\_Weeks](https://forum.ansible.com/u/Chris_Weeks)\
**Post date:** [August 12, 2015, 6:37am UTC](https://forum.ansible.com/t/gluster-volume-module/18674/3 "2015-08-12T06:37:46Z")

</div>

Thank you for sharing this information, I had come across the exact same problem - use case: gluster storage backends for oVirt clusters.

My role includes the following:

- name: Gluster volume exists - {{gvol\_name}}  
gluster\_volume: \>  
state=present  
name={{gvol\_name}}  
brick={{gvol\_brick}}  
options=“{ group: virt, storage.owner-uid: ‘36’, storage.owner-gid: ‘36’ }”

Unfortunately, that syntax still fails with msg: unable to evaluate dictionary for options.

Do you have any tips on the fix or are you able to send a working role/playbook that I can use as an example?

Either way, I appreciate you posting your fault and some success online! 🙂

---

<div class="post-metadata">

**Author:** ![Larry\_Smith1](https://avatars.discourse-cdn.com/v4/letter/l/d26b3c/32.png) [@Larry\_Smith1](https://forum.ansible.com/u/Larry_Smith1)\
**Post date:** [August 12, 2015, 5:45pm UTC](https://forum.ansible.com/t/gluster-volume-module/18674/4 "2015-08-12T17:45:12Z")

</div>

Michael,  
Here is an example that I did some time ago using Ansible to setup GlusterFS. It may help you out.  
[http://everythingshouldbevirtual.com/ansible-playbook-glusterfs-apache](http://everythingshouldbevirtual.com/ansible-playbook-glusterfs-apache)

And also here is a role for GlusterFS that I put out on GitHub.  
[https://github.com/mrlesmithjr/Ansible/tree/master/roles/glusterfs](https://github.com/mrlesmithjr/Ansible/tree/master/roles/glusterfs)

Maybe this will get you going in the right direction.

---

<div class="post-metadata">

**Author:** ![Michael\_Goodness](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@Michael\_Goodness](https://forum.ansible.com/u/Michael_Goodness)\
**Post date:** [August 13, 2015, 1:25am UTC](https://forum.ansible.com/t/gluster-volume-module/18674/5 "2015-08-13T01:25:25Z")

</div>

I’m afraid I can’t offer much in the way of advice, Chris. I decided not to continue my oVirt/GlusterFS experiment, and deleted the roles & playbooks I had written. Your syntax certainly seems to match what worked for me. You might want to try it without “folding-style” (\>), though. Knowing how cranky the gluster\_volume module is about formatting, I wouldn’t be surprised if that’s causing a problem.

Sorry I can’t be of more assistance. Good luck! Let us know when you get it sorted.

---

<div class="post-metadata">

**Author:** ![igorc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/igorc/32/5491_2.png) [@igorc](https://forum.ansible.com/u/igorc)\
**Post date:** [December 7, 2015, 2:27am UTC](https://forum.ansible.com/t/gluster-volume-module/18674/6 "2015-12-07T02:27:11Z")

</div>

Just for the record, removing quotes from your example like this:

options={ group: virt, storage.owner-uid: ‘36’, storage.owner-gid: ‘36’ }

works for me on 1.9.4.
