How to verify all disk size equal

18 views
Skip to first unread message

T. JENISHA

unread,
Sep 17, 2020, 8:24:03 AM9/17/20
to Ansible Project
Hi Team

I need to verify if all disk size equal

I have n number of disk. I have written a loop that gives size of disk. Now how do I verify all disks are equal size?

  - name: Check the size of the disk
        shell: |
            bootinfo -s "{{ item }}"
         with_items: "{{ rootvg.stdout_lines }}"
        register: disk_size

Output  of bootinfo command is size of disk
$ bootinfo -s hdisk0
70006
$ bootinfo -s hdisk1
70006

Thankyou!


Regards
Jenisha 



Dick Visser

unread,
Sep 17, 2020, 9:59:51 AM9/17/20
to ansible...@googlegroups.com
add those numbers to a list, apply the 'unique' filter, then check the length.
If it is 1, then the numbers were all the same.
If it is greater than 2, then there were differences.
> --
> 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 ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAAGhZYj6-BjRft8%3Daiy8tA3XM5LPSh4313i4VPHY1mn0jOdzpQ%40mail.gmail.com.



--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

Antony Stone

unread,
Sep 17, 2020, 10:12:24 AM9/17/20
to ansible...@googlegroups.com
On Thursday 17 September 2020 at 15:59:16, Dick Visser wrote:

> add those numbers to a list, apply the 'unique' filter, then check the
> length. If it is 1, then the numbers were all the same.
> If it is greater than 2, then there were differences.

I'm a pedant, so I'll suggest that "if it's greater than 1, then there were
differences" :)


Antony.

--
I know I always wanted to be somebody, but I guess I should have been more
specific.

Please reply to the list;
please *don't* CC me.
Reply all
Reply to author
Forward
0 new messages