Use the IT automation library fabric (made by python).
fabric must be used with python2.5-2.7 (not compatible with python3)
Using fabric is very easy:
Use pip to install fabric
$ pip install fabric
$ sudo nano fabfile.py
fabfile.py
# coding: utf-8
from fabric.api import env, run, sudo
env.hosts = ["192.168.11.161",
"192.168.11.162",
"192.168.11.163",
"192.168.11.164"]
env.user = "pi"
env.password = "raspberry"
def hello():
run("ifconfig wlan0")
run("ls")
def fix_100m_full():
sudo("ethtool -s eth0 autoneg off speed 100 duplex full")
sudo("ethtool eth0")
Check for executable tasks
$ fab -l
hello
fix_100m_full
Run task (try running an automatic script that turns off Auto-negotiation)
#$ fab <Task name>
$ fab fix_100m_full | grep Auto-nego
[192.168.11.161] out: Auto-negotiation: off
[192.168.11.162] out: Auto-negotiation: off
[192.168.11.163] out: Auto-negotiation: off
[192.168.11.164] out: Auto-negotiation: off
http://fabric-ja.readthedocs.io/ja/latest/tutorial.html
Recommended Posts