Skip to content

Instantly share code, notes, and snippets.

@WinstonN
Last active January 30, 2020 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WinstonN/7b3220c664242f7bf69dd7dd85e18fd0 to your computer and use it in GitHub Desktop.
Save WinstonN/7b3220c664242f7bf69dd7dd85e18fd0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
"""
Fabric 2 script for executing commands on EC2 instances, and docker containers
@author Winston Nolan <winston.nolan@gmail.com>
Installation:
pip3 install fabric2 termcolor boto3
"""
import os
import sys
import requests
import json
import boto3
from fabric import *
from termcolor import colored as c
# vars
# environments
environments = ['dev', 'stg', 'prd']
# user
user_dir = os.environ['HOME']
ssh_config = os.environ['FABRIC_SSH_CONFIG_FILE']
ssh_config_file_path = f"{user_dir}/{ssh_config}"
company = os.environ['FABRIC_COMPANY']
# log
prefix = 'Info: '
# colors
grey = 'grey'
red = 'red'
green = 'green'
yellow = 'yellow'
blue = 'blue'
magenta = 'magenta'
cyan = 'cyan'
white = 'white'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment