Is there a "not equal to" jinja filter?  All of the documentation I find 
shows there's an 'equalto' but I can't seem to find any "no equalto" 
equivalent.  Even a greater than would work but I can't find anything like 
that either.

Harry

On Monday, March 2, 2020 at 11:49:09 AM UTC-5, Daniel Whitley wrote:
>
> Hey Harry-
> That's insightful information about heal_info actually being a list of 
> dicts.  With that being said, while you CAN create a sum (one such way is 
> something like {{ heal_info | map(attribute='no_of_entries') | map('int') | 
> sum() }}), I still question if that is truly necessary.  It sounds to me as 
> if all you care about is waiting until 
> <https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#retrying-a-task-until-a-condition-is-met>
>  
> no_of_entries is 0 for every brick.  Using your initial task, I wonder if 
> this untested pseudo-code could be modified for your needs:
>
>   - name: Find out the healing status of /home
>     gluster_heal_info:
>       name: home
>       status_filter: self-heal
>     register: home_heal_status
>     until: home_heal_status.glusterfs.heal_info | 
> selectattr('no_of_entries','ne','0') | list | count == 0
>     retries: 5
>     delay: 10
>
> Hopefully this is helpful.
> -Daniel
>
> On Mon, Mar 2, 2020 at 9:30 AM harry devine <[email protected] 
> <javascript:>> wrote:
>
>>
>>
>> On Thursday, February 27, 2020 at 1:44:39 PM UTC-5, harry devine wrote:
>>>
>>> Hey Daniel!  This stem from ticket #02582900. Since the stance from 
>>> Support is “we don’t debug playbooks”, I care here. 
>>>
>>> Their suggestion was to make sure that no healing operation was going 
>>> on, stop Gluster, do the “yum update “, then restart Gluster & move to the 
>>> next server. 
>>>
>>> So what I’m trying to accomplish is start with server1, wait for any 
>>> healing operations on our 3 volumes to finish, stop/update/start then move 
>>> to the next. I’m sure this will lead to a “workflow template” 
>>> discussion/approach, but right now this is my starting point. 
>>>
>>> Thanks,
>>> Harry
>>>
>>> On Thu, Feb 27, 2020 at 12:48 PM Daniel Whitley <[email protected] 
>>> <javascript:>> wrote:
>>>
>>>> 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] 
>>>> <javascript:>> 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] <javascript:>.
>>>> 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
>>>>  
>>>> <https://groups.google.com/d/msgid/ansible-project/CA%2BM63kcQw_UTUMW%2BmLXd0uNv3Bgowfdy9yP_v%2B55yW9cKkKN6A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>
>>
>> So to follow up on this:  I looked at this further, and while the 
>> gluster_heal_info module DOES return a heal_info list, its not a list of 
>> files.  It returns the value of every brick (brick name, number of entries, 
>> and stattus):
>>
>> "heal_info": [
>>                 {
>>                     "brick": " server1:/gluster_bricks/brick3/1",
>>                     "no_of_entries": "0",
>>                     "status": "Connected"
>>                 },
>>                 {
>>                     "brick": " server2:/gluster_bricks/brick4/1",
>>                     "no_of_entries": "0",
>>                     "status": "Connected"
>>                 }
>> ]
>>
>> So what I think I need to do is to get the "no_of_entries" value from 
>> every brick and sum them up.  If the sum is zero, I can continue on.  If 
>> the sum is greater than zero, then there is a heal in process, and I need 
>> to wait until that is finished before continuing.  That's the part I'm 
>> getting stuck on.  Also, if you look at the heal_info list, the bricks are 
>> ALL bricks associated with the gluster volume, which is across all gluster 
>> servers.  So would it be safe to assume that if the sum is zero, then there 
>> is no healing occuring on any server, and the continue-on procedure is to 
>> stop gluster on all servers, update them, then restart gluster?
>>
>> Thanks,
>> Harry
>>  
>>
>> -- 
>> 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] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/70668aff-e0fe-4f4f-8606-ffc1cc273f52%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/70668aff-e0fe-4f4f-8606-ffc1cc273f52%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/ad8aedba-71ed-474d-afcf-61fd6dbd1b91%40googlegroups.com.

Reply via email to