Hi, I’m trying to set an option for a gluster volume with this task:
- name: Include hosted_engine volume in virt group
gluster_volume: state=present name=hosted_engine options=‘{group: virt}’
run_once: true
The format is from the 2nd example of gluster_volume module doc. However, the playbook doesn’t run at all:
ERROR! Syntax Error while loading YAML.
The error appears to have been in ‘/home/vagrant/ansible-ovirt/1_prepare_gluster.yml’: line 30, column 69, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Include hosted_engine volume in virt group
gluster_volume: state=present name=hosted_engine options=‘{group: virt}’
^ here
ATTEMPT#2 Changed options to options=‘{group:virt}’ and options={group:virt}, the playbook runs, but failed at this task:
fatal: [172.28.128.3]: FAILED! => {“changed”: false, “failed”: true, “msg”: “argument options is of type <type ‘str’> and we were unable to convert to dict”}
ATTEMPT#3 Changed options to options=“{‘group’:‘virt’}”, the playbook runs, but failed at this task:
fatal: [172.28.128.3]: FAILED! => {“changed”: false, “failed”: true, “module_stderr”: “”, “module_stdout”: “Traceback (most recent call last):\r\n File "/root/.ansible/tmp/ansible-tmp-1458099335.97-214924974739646/gluster_volume", line 2416, in \r\n main()\r\n File "/root/.ansible/tmp/ansible-tmp-1458099335.97-214924974739646/gluster_volume", line 382, in main\r\n probe_all_peers(cluster, peers, myhostname)\r\n File "/root/.ansible/tmp/ansible-tmp-1458099335.97-214924974739646/gluster_volume", line 259, in probe_all_peers\r\n for host in hosts:\r\nTypeError: ‘NoneType’ object is not iterable\r\n”, “msg”: “MODULE FAILURE”, “parsed”: false}
(Don’t know why /root/.ansible/… appears in the error message since I didn’t run the playbook with any root privilege)
I can just ssh into one of my remote hosts and run gluster volume set hosted_engine group virt but would like to know how to do this in Ansible.
I’m using Ansible 2.0.1 in Ubuntu 14.04.3 and all of my remote hosts are CentOS 7.
Thanks a lot.