add fabfile
This commit is contained in:
parent
c8ec7a4894
commit
b2fb4fac28
26
scripts/fabfile/fabfile.py
vendored
Executable file
26
scripts/fabfile/fabfile.py
vendored
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import time
|
||||||
|
from fabric import Connection
|
||||||
|
from fabric import task
|
||||||
|
from optparse import OptionParser
|
||||||
|
|
||||||
|
import serverlist_dev
|
||||||
|
|
||||||
|
def execCmd(svr_conf, cmd):
|
||||||
|
c = Connection(host=svr_conf['host'], user='root', connect_kwargs = {
|
||||||
|
'password': 'kingsome'
|
||||||
|
})
|
||||||
|
c.run(cmd)
|
||||||
|
|
||||||
|
parser = OptionParser(usage="%prog [options]")
|
||||||
|
parser.add_option(
|
||||||
|
"-c",
|
||||||
|
"--cmd",
|
||||||
|
dest = "cmd",
|
||||||
|
help = "cmd"
|
||||||
|
)
|
||||||
|
(options, args) = parser.parse_args()
|
||||||
|
if options.cmd:
|
||||||
|
for a in map(lambda svr_conf : execCmd(svr_conf, options.cmd), serverlist_dev.server_list):
|
||||||
|
pass
|
26
scripts/fabfile/serverlist_dev.py
Normal file
26
scripts/fabfile/serverlist_dev.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
server_list = [
|
||||||
|
{
|
||||||
|
'server_id': 1,
|
||||||
|
'host': '192.168.100.21',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'server_id': 2,
|
||||||
|
'host': '192.168.100.37',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'server_id': 3,
|
||||||
|
'host': '192.168.100.38',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'server_id': 4,
|
||||||
|
'host': '192.168.100.22',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'server_id': 5,
|
||||||
|
'host': '192.168.100.23',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'server_id': 6,
|
||||||
|
'host': '192.168.100.36',
|
||||||
|
}
|
||||||
|
]
|
Loading…
x
Reference in New Issue
Block a user