Ansible command to get the ethtool information

946 views
Skip to first unread message

Jai Reddy

unread,
Apr 20, 2016, 3:21:27 PM4/20/16
to Ansible Project
Greetings,

  I am trying to get the nic (eth0) info using ansible .. 

When I am running below ansible command I am getting error
ansible all -m shell -a "/sbin/ethtool eth0"
SSH password:
SUDO password[defaults to SSH password]:
hosts.example.com | FAILED | rc=75 >>
Settings for eth0:
No data availableCannot get device settings: Operation not permitted
Cannot get wake-on-lan settings: Operation not permitted
Cannot get link status: Operation not permitted

but "ansible all -m shell -a "/sbin/ifconfig -a eth0"" completes with no issues..

Any help with the syntax.

Kai Stian Olstad

unread,
Apr 23, 2016, 3:11:19 PM4/23/16
to ansible...@googlegroups.com
On 20. april 2016 00:26, Jai Reddy wrote:
> Greetings,
>
> I am trying to get the nic (eth0) info using ansible ..
>
> When I am running below ansible command I am getting error
> ansible all -m shell -a "/sbin/ethtool eth0"
> SSH password:
> SUDO password[defaults to SSH password]:
> hosts.example.com | FAILED | rc=75 >>
> Settings for eth0:
> No data availableCannot get device settings: Operation not permitted
> Cannot get wake-on-lan settings: Operation not permitted
> Cannot get link status: Operation not permitted

The return messages says you do not have permission, have you tried
running it as root?
Add -s to the ansible command to run it with sudo.

--
Kai Stian Olstad

Mahendra

unread,
Apr 25, 2016, 7:50:30 PM4/25/16
to Ansible Project, ansible-pr...@olstad.com
Hello Kai,

  Thanks for the update.. 

  yes it works as root..

 And I have used "-s" option ..

  ansible root# ansible all -m shell -a "/sbin/ethtool eth4"  -s
SSH password:
SUDO password[defaults to SSH password]:
xxx.example.com | success | rc=0 >>
Settings for eth4:
Current message level: 0x00000007 (7)
      drv probe linkCannot get device settings: Operation not permitted
Cannot get wake-on-lan settings: Operation not permitted
Cannot get link status: Operation not permitted

ansible all -m shell -a "/sbin/ethtool eth4 |grep -i Speed "  -s
SSH password:
SUDO password[defaults to SSH password]:
xxx.example.com | FAILED | rc=1 >>
Cannot get device settings: Operation not permitted
Cannot get wake-on-lan settings: Operation not permitted
Cannot get link status: Operation not permitted

Johannes Kastl

unread,
May 3, 2016, 3:21:29 AM5/3/16
to ansible...@googlegroups.com
On 26.04.16 01:50 Mahendra wrote:

> ansible root# ansible all -m shell -a "/sbin/ethtool eth4" -s

>> > I am trying to get the nic (eth0) info using ansible ..

Maybe your nic is not called eth0 on all hosts? You use eth4 later on,
so on some hosts this would cause trouble.

Also, does ansible's setup module not contain the info?

ansible -m setup foobar

displays the facts for host foobar, this contains some info on the nics...

Johannes

signature.asc
Reply all
Reply to author
Forward
0 new messages