I'm using the gluster_heal_info module to check the heal status of a 
gluster volume.  What I'd like to do is gather the "no_of_entries" 
parameter, sum them up, and it if it is 0, move to the next step of 
stopping gluster on that server, update it, and restart the service.  The 
playbook below is my initial test to see how to grab that information.  It 
is giving me the following error:

 [root@test-server ~]#ansible-playbook gluster_heal_info.yml --limit 
storage1.tc.secure-ose.faa.gov -K
BECOME password:

PLAY [gluster] 
*************************************************************************************************************************************

TASK [Find out the healing status of /home] 
********************************************************************************************************
ok: [gluster1]

TASK [set_fact] 
************************************************************************************************************************************
fatal: [gluster1]: FAILED! => {"msg": "Unexpected templating type error 
occurred on ({{ home_heal_status.glusterfs.heal_info | 
sum(attribute='no_of_entries', start=[]) }}): can only concatenate list 
(not \"AnsibleUnsafeText\") to list"}


I'm not too familiar with jinja2 templates yet, so I'm sure I'm not doing 
something correct.  Can anyone point me in the right direction?

Thanks,
Harry

---
- hosts: gluster
  become: yes
  become_method: sudo
  gather_facts: no

  tasks:

  - name: Find out the healing status of /home
    gluster_heal_info:
      name: home
      status_filter: self-heal
    register: home_heal_status

  - set_fact:
      home_heal_entries: "{{ home_heal_status.glusterfs.heal_info | 
sum(attribute='no_of_entries', start=[]) }}"
  - debug:
      msg: "Heal entries: {{ home_heal_entries }}"

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/aaeba2b2-5b21-4f9e-9784-5721a9aa66e2%40googlegroups.com.

Reply via email to