Skip to content

Instantly share code, notes, and snippets.

@6LYTH3
Forked from anonymous/iFabric101.py
Last active August 29, 2015 14:06
Show Gist options
  • Save 6LYTH3/87b5ecd9115352184373 to your computer and use it in GitHub Desktop.
Save 6LYTH3/87b5ecd9115352184373 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