find_output with filter

31 views
Skip to first unread message

Nagesh sheregar

unread,
Sep 1, 2020, 6:32:20 PM9/1/20
to Ansible Project
Hi Team,

i would like to see only GREEN/RED in out put, can you please let me know how i can filter it?
Playbook:

- name: sddc health
  command: /opt/vmware/sddc-support/sos --health-check
  register: find_output
- debug:
     var: find_output
=========================

Output:

====================

 SL# |                                  Area                                 |                            Title                            | State |",
            "+-----+-----------------------------------------------------------------------+-------------------------------------------------------------+-------+",
            "|  1  |                                                                       |                    Total no. of disks : 9                   | \u001b[1;32mGREEN\u001b[0m |",
            "|     |                                                                       |                      vSAN Health Status                     | \u001b[1;32mGREEN\u001b[0m |",
            "|  2  |                                                                       |                    Total no. of disks : 9                   | \u001b[1;32mGREEN\u001b[0m |",
            "|     |                                                                       |                      vSAN Health Status                     | \u001b[1;32mGREEN\u001b[0m |",
            "|  3  |                                                                       |                    Total no. of disks : 9                   | \u001b[1;32mGREEN\u001b[0m |",
            "|     |                                                                       |                      vSAN Health Status                     | \u001b[1;32mGREEN\u001b[0m |",
            "|  4  |                                                                       |                    Total no. of disks : 9                   | \u001b[1;32mGREEN\u001b[0m |",
            "|     |                                                                       |                      vSAN Health Status                     | \u001b[1;32mGREEN\u001b[0m |",
            "|  5  |                                                                       |                    Total no. of disks : 9                   | \u001b[1;32mGREEN\u001b[0m |",
            "|     |                                                                       |                      vSAN Health Status                     | \u001b[1;32mGREEN\u001b[0m |",
            "|  6  |                                                                       |                    Total no. of disks : 9                   | \u001b[1;32mGREEN\u001b[0m |",
            "|     |                                                                       |                      vSAN Health Status                     | \u001b[1;32mGREEN\u001b[0m |",
            "|  7  |                                                                       |                    Total no. of disks : 9                   | \u001b[1;32mGREEN\u001b[0m |",
            "|     |                                                                       |                      vSAN Health Status                     | \u001b[1;32mGREEN\u001b[0m |",
            "|  8  |                                                                       |                    Total no. of disks : 9                   | \u001b[1;32mGREEN\u001b[0m |",
            "|     |                                                                       |                      vSAN Health Status                     | \u001b[1;32mGREEN\u001b[0m |",
            "|  9  |                                                                       |              ** Stretched cluster is disabled.              |       |",
            "|     |                                                                       |                  Cluster vSAN Health Status                 | \u001b[1;32mGREEN\u001b[0m |",
            "|     |                                                                       |          ** Deduplication enabled on this cluster.          |       |",
            "|     |                                                                       |           ** Encryption disabled on this cluster.           |       |",
            "|     |                                                                       |           ** Compression enabled on this cluster.           |       |",
            "|     |                                                                       |              Total no. of hosts in cluster : 8              | \u001b[1;32mGREEN\u001b[0m |",
            "|  10 |                                                                       |  Node-20a8c662-1bab-43ff-b190-71d6a9c0bc51-NSX-controller-3 | \u001b[1;32mGREEN\u001b[0m |",
            "|     |                                                                       |                        centos-6-dHJ8                        | \u001b[1;32mGREEN\u001b[0m |",
            "|     |                                                                       |                      WIN2012DTC-64-FxZS                     | \u001b[1;32mGREEN\u001b[0m |",

Nagesh sheregar

unread,
Sep 2, 2020, 7:13:44 AM9/2/20
to ansible...@googlegroups.com
Hi Team,

Any help is appreciated?

Thanks 

--


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/f80f2498-1258-4f99-9bf5-f2a0edde706bn%40googlegroups.com.


Dick Visser

unread,
Sep 2, 2020, 1:35:16 PM9/2/20
to ansible...@googlegroups.com
I would use the json output option of the sos tool and then filter things.
Manipulating that big block of text will be very cumbersome and fragile.

Fyi this list is not exactly a 'team' but more a collection of individuals willing to help.



--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.


Nagesh sheregar

unread,
Sep 2, 2020, 1:38:11 PM9/2/20
to ansible...@googlegroups.com
Thank you so much for the info .. 

Reply all
Reply to author
Forward
0 new messages