Hey Harry-
I saw this over my lunch break and thought I'd ask if it really matters
(meaning, do you use it later or something) what the count/sum is or if you
just want to wait until something is true (such as the number of "heals" is
0).  If the count doesn't really matter, I wonder if you could take
advantage of until
<https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#retrying-a-task-until-a-condition-is-met>
in your "Find out the healing status of /home" task?  It looks like the
gluster_heal_info
<https://docs.ansible.com/ansible/latest/modules/gluster_heal_info_module.html>
module returns a list of files in "heal_info" so you may just want to wait
"until" that list is empty before moving on to the next task?  I've not
tried this nor ever used the module.  I also realize it doesn't address the
question you asked, but you should be used to that from me at this point. :)
-Daniel


On Thu, Feb 27, 2020 at 9:38 AM harry devine <[email protected]> wrote:

> 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/CA%2BM63kcQw_UTUMW%2BmLXd0uNv3Bgowfdy9yP_v%2B55yW9cKkKN6A%40mail.gmail.com.

Reply via email to