How exactly are the stats output on the host?

If the programs that produce them send them to standard output, then one
option would be to run the commands and redirect their outputs to a file.
When all the programs have been run, copy that file to wherever you need
it. Remember to append for all but the first command.

Also, I don't understand what you mean about *(.*):(.*): ''*

A better mechanism (IMHO) would be to write a shell script that generates
all the stats in the order you want them, and either have that script write
to a file or redirect its output to a file. Then just grab that file. If
the stats are to be obtained from multiple machines you could copy the
script to each with Ansible and then execute it. If it's just one host, you
could leave the script on that host. It depends on where would be the most
appropriate place to maintain the script.

Regards, K.




On Sat, Apr 18, 2020 at 7:50 PM Samir Kothawade <[email protected]>
wrote:

> Also, There is a limitation on remote host - It does not have xrandr
> module. So, changing screen size with xrandr will not be  available :(
>
> On Saturday, 18 April 2020 14:45:18 UTC+5:30, Samir Kothawade wrote:
>>
>> Hi,
>>
>> *Here is the brief about scenario: *
>>
>> 1. login to Debian host machine using ansible
>> 2. Go to corresponding directory where the binary is and execute that
>> binary. (This binary is written in c and C++. After execution it ask for
>> the userid & password)
>> 3. After login into that binary's shell, it  has several commands which
>> displays statistics. Those stats are lengthy and does not fit in current
>> screen resolution. For seen seeing all the stats we have to press Down
>> arrow Key or Enter key multiple time until we reach to last stat line.
>>
>> *How I am doing this: *
>>
>> *-** hosts: sam*
>> *  gather_facts: no*
>> *  tasks:*
>> *  - name: capture all stats*
>> *    ignore_errors: yes*
>> *    expect:*
>> *      command: /opt/abc/xyz_Platform/bin/go_xyz_cli*
>> *      responses:*
>> *        (.*)Username:(.*): "admin"*
>> *        (.*)Password:(.*): "admin"*
>> *        (.*)xyz_cli>(.*): display all debug stats*
>> *        (.*):(.*): ''*
>> *    register: stats*
>> *  - local_action: copy content="{{ stats.stdout}}"
>> dest="/home/sam/quickstats/stats.txt"*
>> *    ignore_errors: yes*
>>
>>
>> *Issues Facing : *
>>
>> 1. Multiple similar line gets copied in stats.txt file when above reaches
>> to ==>>*  (.*):(.*): ''*  (See above code section marked in blue). Using
>> this method to press <enter> key.
>> 2. Actual stats counts are of line 500 hundred but above code returns 2k
>> + stats with repetitive stats and some garbage values appended.
>> 3. If i removes this  portion *  (.*):(.*): ''*  from code, then above
>> script only copies 20-30 lines which currently are displayed on screen or
>> which displayed in current screen size.
>>
>>
>> I guess I can achieve this by changing remote servers' screen size. but I
>> could not able to get any such way in ansible.
>>
>>
>> May I request you to help me in this ?
>>
> --
> 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/1ee2dc0f-11c5-4644-b1fb-dec87ade59ed%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/1ee2dc0f-11c5-4644-b1fb-dec87ade59ed%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 

*Karl Auer* { manager, systems support }
P: 1300 759 975
E: [email protected]
2pisoftware.com

GPG/PGP : DF6A 43E5 FB9D D884 C6CA CD7F 5278 212D E80F C107
Previous: 301B 1F4E 624D AD99 242C 7A68 EC24 7113 E854 4A4E

-- 
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%2B%2BT08QCC3hzXjPPcyfYoRygtC0GzwWMiKhUqxOJ18F-UmiSKQ%40mail.gmail.com.

Reply via email to