Created
January 2, 2013 21:17
-
-
Save bassdread/4438138 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fabric.api import * | |
import fabric | |
env.hosts=["ec2-23-22-191-90.compute-1.amazonaws.com"] | |
env.user="ec2-user" | |
def hostname_check(): # hostname_check is just a task name, replace with anything | |
run("hostname") | |
def install_agent(key, url): | |
f = open('config.cfg', 'r') | |
config_file = f.read() | |
f.close() | |
config_file = config_file % (url, key) | |
f = open('populated_config.cfg', 'w') | |
f.write(config_file) | |
f.close() | |
f = open('serverdensity.repo', 'r') | |
repo = f.read() | |
f.close() | |
sudo("rpm --import https://www.serverdensity.com/downloads/boxedice-public.key") | |
run("wget https://www.serverdensity.com/downloads/boxedice-public.key") | |
sudo("rpm --import boxedice-public.key") | |
sudo("echo '%s' >> /etc/yum.repos.d/serverdensity.repo" % (repo)) | |
sudo('yum install -y sd-agent') | |
fabric.operations.put('./populated_config.cfg', '/etc/sd-agent/', use_sudo=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment