All,
I’m trying to loop over play_hosts to build out my cluster in a glusterfs configuration ansible/ruby block. I’m not sure of the best way to do this, but would like any feedback you can provide.
I didn’t believe with_items would work in this situation, because I’m trying to inject x number of unknown items to build a glusterfs cluster. The items are determined from the current inventory/playlist, I’m trying to avoid changing inventory files unless absolutely required.
Here is what I’ve tried (am I headed down the right path?):
`
- name: create gluster volume
gluster_volume:
state: present
name: gluster0
bricks: /bricks/brick1/g1
rebalance: yes
replicas: yes
cluster: |
{% for host in play_hosts %}
“- {{hostvars[host].ansible_default_ipv4.address}}”
{% endfor %}
run_once: true
sudo: yes
`
Thanks,
Shaun