The command module runs the ping. It won't display the output you register in 
ping_result. You need a debug task if you want to see the result. If you want 
formatted output you may want to look at using a jinja2 template.

Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123

On Nov 15, 2022, at 11:11 PM, saravanan jothilingam 
<[email protected]<mailto:[email protected]>> wrote:

We have around 300+ on-prem linux servers to manage its availability. We found 
ansible is one easy tool to manage it.

On Wed, Nov 16, 2022 at 9:20 AM Dick Visser 
<[email protected]<mailto:[email protected]>> wrote:
Hi
What is the reason you need to use ansible for this?

On Wed, 16 Nov 2022 at 04:09, saravanan jothilingam 
<[email protected]<mailto:[email protected]>> wrote:
Hi,
I need to get the ping status of all remote hosts and print its results in one 
neat tabular column format. Since I am a novice to ansible, I am looking for 
the appropriate playbook which does this.

note - the below task doesnt give any clear output .
- name: check reachable hosts
  hosts: remote-hosts
  gather_facts: no
  tasks:
    - command: ping -c1 {{ inventory_hostname }}
      delegate_to: localhost
      register: ping_result

Thanks

saravanan

--
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]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAE7H9qoRWWw%3D1gbLETVztDvWrgC_hupW_X_7OxJWTAc70mRvSw%40mail.gmail.com<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2FCAE7H9qoRWWw%253D1gbLETVztDvWrgC_hupW_X_7OxJWTAc70mRvSw%2540mail.gmail.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7Ca6a29b5c695d4aafa72e08dac7889c8f%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638041686828749935%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=gk3VlaJ9hB0jjnsmlJqoa4etXg%2BbtY4dz5Onlki7krQ%3D&reserved=0>.
--
Sent from Gmail Mobile

--
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]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAF8BbLZDyGa7VpRiQ5f1%3D%3Dup1CBb32pRDu_6vHULW_BOhNR%2BBA%40mail.gmail.com<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2FCAF8BbLZDyGa7VpRiQ5f1%253D%253Dup1CBb32pRDu_6vHULW_BOhNR%252BBA%2540mail.gmail.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7Ca6a29b5c695d4aafa72e08dac7889c8f%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638041686828749935%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Kj%2Bk0a4KgkFvfWcXzXBmOd47hBOvaH9ayI52zf577uo%3D&reserved=0>.

--
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]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAE7H9qp9%3DiwQeekbLTHeBRZXqGntff19SxtqUfjVt4Z63_q0vg%40mail.gmail.com<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2FCAE7H9qp9%253DiwQeekbLTHeBRZXqGntff19SxtqUfjVt4Z63_q0vg%2540mail.gmail.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7Ca6a29b5c695d4aafa72e08dac7889c8f%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638041686828749935%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Z3Lh2SEkQkljDdr1MWeKFR1OIHz54pTNYkz%2Bo0XAp3o%3D&reserved=0>.

-- 
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/AE75345F-80D8-43CB-BB4F-CEFBC41A9352%40nist.gov.

Reply via email to