<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sidharthan</title>
    <description>The latest articles on DEV Community by Sidharthan (@madsid659).</description>
    <link>https://dev.to/madsid659</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F540126%2F0448fd57-adba-4926-a5a6-92535feb8507.png</url>
      <title>DEV Community: Sidharthan</title>
      <link>https://dev.to/madsid659</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/madsid659"/>
    <language>en</language>
    <item>
      <title>Ansible Ad-Hoc commands for easy use </title>
      <dc:creator>Sidharthan</dc:creator>
      <pubDate>Tue, 15 Dec 2020 05:18:05 +0000</pubDate>
      <link>https://dev.to/madsid659/ansible-ad-hoc-commands-for-easy-use-4ij0</link>
      <guid>https://dev.to/madsid659/ansible-ad-hoc-commands-for-easy-use-4ij0</guid>
      <description>&lt;p&gt;Hello Everyone,&lt;br&gt;
I would like to share my first post here,&lt;br&gt;
we know ansible is a great tool for automation in DevOps field. it has a great documentation though.&lt;br&gt;
Ansible is maintaining its playbooks documentation great.&lt;br&gt;
here, i would like to introduce some of you may know.&lt;br&gt;
ad-hoc command is the one-liner ansible command that performs one task on the target hosts. It allows you to execute simple one line  task against one or group of hosts defined on the inventory file configuration. &lt;br&gt;
eg:&lt;/p&gt;

&lt;h2&gt;
  
  
  To get route table of a node
&lt;/h2&gt;

&lt;p&gt;root@kube-master:~# ansible all  -m shell -a 'route '&lt;br&gt;
192.168.122.3 | CHANGED | rc=0 &amp;gt;&amp;gt;&lt;br&gt;
Kernel IP routing table&lt;br&gt;
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface&lt;br&gt;
default         _gateway        0.0.0.0         UG    0      0        0 enp1s0&lt;br&gt;
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 enp1s0&lt;/p&gt;

&lt;h2&gt;
  
  
  To check the available disk space
&lt;/h2&gt;

&lt;p&gt;root@kube-master:~# ansible all  -m shell -a 'df -h'&lt;br&gt;
192.168.122.3 | CHANGED | rc=0 &amp;gt;&amp;gt;&lt;br&gt;
Filesystem                         Size  Used Avail Use% Mounted on&lt;br&gt;
udev                               1.9G     0  1.9G   0% /dev&lt;br&gt;
tmpfs                              394M  1.6M  393M   1% /run&lt;br&gt;
/dev/mapper/ubuntu--vg-ubuntu--lv   19G   15G  3.5G  81% /&lt;br&gt;
tmpfs                              2.0G   16K  2.0G   1% /dev/shm&lt;br&gt;
tmpfs                              5.0M     0  5.0M   0% /run/lock&lt;br&gt;
tmpfs                              2.0G     0  2.0G   0%                  19G   15G  3.5G  81% &lt;br&gt;
root@kube-master:~#&lt;/p&gt;

&lt;h2&gt;
  
  
  To call a script
&lt;/h2&gt;

&lt;p&gt;root@kube-master:~# ansible all  -m shell -a 'bash test.sh'&lt;br&gt;
192.168.122.3 | CHANGED | rc=0 &amp;gt;&amp;gt;&lt;br&gt;
hell world&lt;br&gt;
root@kube-master:~#&lt;/p&gt;

&lt;p&gt;here, we are using a module "shell" and applying the command on a target server. &lt;/p&gt;

&lt;p&gt;Hope you may get some extra knowledge from this post&lt;br&gt;
Thanks&lt;br&gt;
Sid&lt;/p&gt;

</description>
      <category>ansible</category>
      <category>devops</category>
      <category>linux</category>
    </item>
  </channel>
</rss>
