Nov 18, 2021

Ansible command lines

 Ansible command line helps you to meet your requirement without creating & running playbook.

The purpose of Ansible command is basically:

--> run a single task

--> helpful to run some ad-hoc commands e.g., server uptime, date, filesystem usage report etc.


syntax:  ansible <host-pattern> [options]

-u REMOTE_USER

-m MODULE_NAME

-a module arguments

-i specify inventory host path or comma separated host

-s run operations with sudo

Examples:

1) Get uptime of remote servers:

# ansible all -m command -a uptime

192.168.100.2 | CHANGED | rc=0 >>

 06:04:05 up 3 days, 18:03,  1 user,  load average: 1.49, 1.12, 1.03

192.168.100.1 | CHANGED | rc=0 >>

 06:04:05 up 3 days, 18:02,  1 user,  load average: 1.01, 1.06, 1.08

2) Show hostnames of remote server:

# ansible all -m command -a /usr/bin/hostname

192.168.100.1 | CHANGED | rc=0 >>

example01

192.168.100.2 | CHANGED | rc=0 >>

example02

3) See remote server OS version:

# ansible all -m command -a "cat /etc/redhat-release"

192.168.100.2 | CHANGED | rc=0 >>

Red Hat Enterprise Linux Server release 7.8 (Maipo)

192.168.100.1 | CHANGED | rc=0 >>

Red Hat Enterprise Linux Server release 7.8 (Maipo)

4) See file system usage:

# ansible all -m command -a "df -h /u01"

192.168.100.2 | CHANGED | rc=0 >>

Filesystem      Size  Used Avail Use% Mounted on

/dev/sdb1       300G  183G  118G  61% /u01

192.168.100.1 | CHANGED | rc=0 >>

Filesystem      Size  Used Avail Use% Mounted on

/dev/sdb1       300G  192G  109G  64% /u01

5) See remote server dates:

# ansible all -m command -a "date"

192.168.100.2 | CHANGED | rc=0 >>

Thu Nov 18 06:08:13 GMT 2021

192.168.100.1 | CHANGED | rc=0 >>

Thu Nov 18 06:08:13 GMT 2021


11 comments:

  1. A few months ago, I felt so depressed, I got frustrated with bad credits, but then I contacted HACK VANISH by phone: +1 (747) 293-8514 and email: HACK VANISH (@) GMAIL. COM. I found out about hack vanish services through positive reviews read on some credit blogs, in a blink of an eye this great hacker restored my credit score from 509 to 784 in all 3 major credit bureaus, they got removed evictions and foreclosures, my LexisNexis and Chex system was repaired respectively, a few days later I received an email confirming the approval of my mortgage loan, it was quite surprising because I never thought it was possible. Today, I can confidently say that 2021 was a banner year for my husband and I as we now own a new house and a new SUV courtesy of HACK VANISH, I would definitely recommend him to anyone in need of a genuine Hacker.

    ReplyDelete
  2. All thanks to Mr Anderson for helping with my profits and making my fifth withdrawal possible. I'm here to share an amazing life changing opportunity with you. its called Bitcoin / Forex trading options. it is a highly lucrative business which can earn you as much as $2,570 in a week from an initial investment of just $200. I am living proof of this great business opportunity. If anyone is interested in trading on bitcoin or any cryptocurrency and want a successful trade without losing notify Mr Anderson now.Whatsapp: (+447883246472 )
    Email: tdameritrade077@gmail.com

    ReplyDelete
  3. I lost my job few months back and there was no way to get income for my family, things was so tough and I couldn't get anything for my children, not until a met a recommendation on a page writing how Mr Bernie Wilfred helped a lady in getting a huge amount of profit every 6 working days on trading with his management on the cryptocurrency Market, to be honest I never believe it but I took the risk to take a loan of $1000. and I contacted him unbelievable and I was so happy I earn $12,500 in 6 working days, the most joy is that I can now take care of my family I don't know how to appreciate your good work Mr. Bernie Doran God will continue to bless you for being a life saver I have no way to appreciate you than to tell people about your good services.
For a perfect investment and good strategies contact Mr Bernie Doran via WhatsApp :+1(424)285-0682 or Telegram : @Bernie_doran_fx or Email : Bernie.doranfx01@gmail.com

    ReplyDelete
  4. LEGIT FULLZ & TOOLS STORE

    Hello to All !

    We are offering all types of tools & Fullz on discounted price.
    If you are in search of anything regarding fullz, tools, tutorials, Hack Pack, etc
    Feel Free to contact

    ***CONTACT 24/7***
    **Telegram > @leadsupplier
    **ICQ > 752822040
    **Skype > Peeterhacks
    **Wicker me > peeterhacks

    "SSN LEADS/FULLZ AVAILABLE"
    "TOOLS & TUTORIALS AVAILABLE FOR HACKING, SPAMMING,
    CARDING, CASHOUT, CLONING, SCRIPTING ETC"

    **************************************
    "Fresh Spammed SSN Fullz info included"
    >>SSN FULLZ with complete info
    >>CC With CVV (vbv & non vbv) Fullz USA
    >>FULLZ FOR SBA, PUA & TAX RETURN FILLING
    >>USA I.D Photos Front & Back
    >>High Credit Score fullz (700+ Scores)
    >>DL number, Employee Details, Bank Details Included
    >>Complete Premium Info with Relative Info

    ***************************************
    COMPLETE GUIDE FOR TUTORIALS & TOOLS

    "SPAMMING" "HACKING" "CARDING" "CASH OUT"
    "KALI LINUX" "BLOCKCHAIN BLUE PRINTS" "SCRIPTING"
    "FRAUD BIBLE"

    "TOOLS & TUTORIALS LIST"
    =>Ethical Hacking Ebooks, Tools & Tutorials
    =>Bitcoin Hacking
    =>Kali Linux
    =>Fraud Bible
    =>RAT
    =>Keylogger & Keystroke Logger
    =>Whatsapp Hacking & Hacked Version of Whatsapp
    =>Facebook & Google Hacking
    =>Bitcoin Flasher
    =>SQL Injector
    =>Premium Logs (PayPal/Amazon/Coinbase/Netflix/FedEx/Banks)
    =>Bitcoin Cracker
    =>SMTP Linux Root
    =>Shell Scripting
    =>DUMPS with pins track 1 and 2 with & without pin
    =>SMTP's, Safe Socks, Rdp's brute
    =>PHP mailer
    =>SMS Sender & Email Blaster
    =>Cpanel
    =>Server I.P's & Proxies
    =>Viruses & VPN's
    =>HQ Email Combo (Gmail, Yahoo, Hotmail, MSN, AOL, etc.)

    *Serious buyers will always welcome
    *Price will be reduce in bulk order
    *Discount offers will give to serious buyers
    *Hope we do a great business together

    ===>Contact 24/7<===
    ==>Telegram > @leadsupplier
    ==>ICQ > 752822040
    ==>Skype > Peeterhacks
    ==>Wicker me > peeterhacks

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete
  6. Beware  of scammers i have been scammed 3 times because i was trying to know if my husband was cheating until i met this hacker named; (wizardcyprushacker@gmail.com)  who helped me hack into my spouse phone for real this great hacker hacked into my spouse whats-app messages,Facebook messages.text messages,call logs,deleted text messages,bitcoin recovery and bank transfer hack,clear criminals records,and many more i was impressed with his job and he brought me results under 24 hours believe me he is real and his services are cheap and affordable. whatsapp +1 (424) 209-7204

    ReplyDelete
  7. This comment has been removed by a blog administrator.

    ReplyDelete
  8. This comment has been removed by a blog administrator.

    ReplyDelete
  9. This comment has been removed by a blog administrator.

    ReplyDelete
  10. This comment has been removed by a blog administrator.

    ReplyDelete
  11. This comment has been removed by a blog administrator.

    ReplyDelete

Translate >>