Skip to content

Instantly share code, notes, and snippets.

Created September 15, 2014 09:31
Show Gist options
  • Save anonymous/c769233e723b6c2bdf82 to your computer and use it in GitHub Desktop.
Save anonymous/c769233e723b6c2bdf82 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
from fabric.api import *
from fabric.contrib.console import confirm
import sys
import os
import subprocess
env.hosts = ['192.168.1.8']
env.user = 'root'
env.password = 'a'
def host_type():
run('hostname')
def mk_directory():
"""
Make Directory into /tmp
"""
host_type()
result = run("ls -ld /tmp/abc")
if result.failed:
run("mkdir /tmp/abc")
if __name__ == '__main__':
if len(sys.argv) > 1:
subprocess.call(['fab', '-f', __file__] + sys.argv[1:])
else:
subprocess.call(['fab', '-f', __file__, '--list'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment